关于 NULL select from toids ; id name birth city +++ 1 张三 20001201 00:00:00 北京 2 李四 19970324 00:00:00 上海 3 王五 20040901 00:00:00 广州 4 陈六 20220101 00:00:00 (4 rows) teledb select count(city) from toids; count 3 (1 row) teledb select count(1) from toids; count 4 (1 row) teledb select count() from toids; count 4 (1 row) teledb select count(id) from toids; count 4 (1 row) teledb select count((id,city)) from toids; count 4 (1 row) 4. count(distinct col) 计算某列的非 NULL 不重复数量,NULL 不被计数。 count(distinct (col1,col2,...) ) 计算多列的唯一值时,NULL 会被计数,同时 NULL 与 NULL 会被认为是相同的。 teledb select count(distinct city) from toids; count 3 (1 row) teledb select count(distinct (id, city)) from toids; count 4 (1 row) 5. 两个NULL 的对比方法。 teledb select null is not distinct from null; ?column? t (1 row)