8.27
1.复杂语句
having和order by
select id,count(*) as num
from products
group by id
having count(*)>=2
select num,count(*) as items
from orderitems
gruop by num
having count(*)>=3
order by items,num
8.26
1.concat函数用于拼接
select Concat(name,’(’,contury,’)’) from venders order by name;
结合成一个计算字段的两个列用空格填充,想要去掉这些空格使用trim函数,rtrim()去掉右边的空格,ltrim()去掉左边的空格,trim()去掉字符串左右两边的空格。
2.sql中文本处理函数
其中SOUNDEX是一个将任何文本字符串转化为描述其语音标识的字母数字模式的算法。