一、查询
1.找出那些没有被 id = 2 的客户推荐的客户的姓名:not in
select name from Customer where id not in(
select id from Customer where referee_id = 2
);
2.去除重复行并排序:distinct;order by
select distinct author_id as id from Views where author_id=viewer_id order by author_id
3.计算字符串长度:char_length(全适合) length(汉字按照2-3字节来算)
select tweet_id from Tweets where length(content)>15
二.连接
1.全连接-求比前一天气温高的日期
select a.id from Weather a join Weather b on a.temperature > b.temperature and datediff(a.recordDate,b.recordDate)=1