[SQL] how do I count all the column NULL values in the table without manually entering each column name?

I want to calculate how many NULL there are in each column of the table. But I don"t want to write as:

SELECT SUM(CASE WHEN columns1 IS NULL THEN 0 ELSE 1),
       SUM(CASE WHEN columns2 IS NULL THEN 0 ELSE 1),
       SUM(CASE WHEN columns3 IS NULL THEN 0 ELSE 1),
       SUM(CASE WHEN columns4 IS NULL THEN 0 ELSE 1),
       .....
FROM table      

is there any good idea? Using SQLite.

Jul.19,2022

subquery, query all column names, and then surround it with the column names just looked up by for...in, okay?

Menu