1. 查询
select count(*) from table;
selelct count(字段) from table;
2. 数量
select *,count(*) from table group by 字段1, 字段2, 字段3 having count(*) >1;
最后一列为重复次数
select * from table a where ( a.字段1, a.字段2, a.字段3) in ( select 字段1, 字段2, 字段3 from table group by 字段1, 字段2, 字段3 having count(*)>1 )
3. 空
select * from table where 字段 is null or 字段 = '' ;
4. 匹配
SELECT * FROM proj WHERE id NOT IN ( SELECT DISTINCT pro_id FROM room ) ORDER BY name;