字段的三种不同状态
select distinct status from t_table
(NULL)
XXX
YYY
不同状态的记录数
select count(1) from t_table 35709
select count(1) from t_table where status = 'XXX' 17579 XXX
select count(1) from t_table where status = 'YYY' 4242 YYY
select count(1) from t_table where status is null 13888 (NULL)
select count(1) from t_table where status = null 0
select count(1) from t_table where status is not null 21821 XXX+ YYY
select count(1) from t_table where status <> null 0
select count(1) from t_table where status != null 0
1
select count(1) from t_table where status != 'XXX' 4242 不含null值记录
select count(1) from t_table where status != 'YYY' 17579 不含null值记录
select count(1) from t_table where status != 'XXX' and status != 'YYY' 0 != 不包含 null值的记录
2
select count(1) from t_table where status in (select status from t_table)