m)去掉重复的distinct:
select distinct name from t_person;
例子:列出当前系统中拥有的设备种类,不包括重复的
Select distinct type from t_device
n)limit:
select * from t_user limit offset, length;
类似top(前10条记录):
select * from t_user limit 10;
offset从哪开始;length多长(即每页显示条数)
例子:按照年龄排序,查询前两个用户
Select * from t_user order by age desc limit 0, 2
o)in:
select * from t_user where id in (1, 2, 3...);
查询设备ID为1、2或3的设备
Select * from t_device where id in (1,2,3)
In的反过程,not in
例子:
查询ID不为1、2、3的设备
Select * from t_device where id not in (1,2,3)