我尝试了以下查询,这些查询只给出空值的计数,我需要的是进行空检查并返回列名。
select count(*)-count(columnA), count(*)-count(columnB) from table;
select count(*) from table where columnA is null;
答案 0 :(得分:0)
您也可以
SELECT
SUM(IF(columnA is NULL,1,0)) as canulls,
SUM(IF(columnB is NULL,1,0)) as cbnulls
FROM table;
这也将为您提供每列的空字段数。