Pandas is offering
df.isnull().sum()
to count the NAN values per each column. Is there something similar in SQL?
Pandas is offering
df.isnull().sum()
to count the NAN values per each column. Is there something similar in SQL?
No idea what Pandas is but good old CASE
should do (and it works in all major database engines):
SELECT COUNT(CASE WHEN column_name IS NULL THEN 1 END) ...
You can use:
SELECT COUNT(*) - COUNT(column_name)
FROM table_name
COUNT(*)
(or, equivalently, COUNT(1)
) will count rows regardless of whether any columns have NULL
values and COUNT(column_name)
will count the non-NULL
values (and, if it exists, can use an index on that column).