Count the number of NULL columns in each row
15/06/22 17:30
SQL is good at processing set of rows, but what about columns…
Here an easy way to count number of nulls in a set of columns per row.
Here an easy way to count number of nulls in a set of columns per row.
select pk, json_value( json_array( list of columns ), '$.size()' ) as n_non_null_columns from your_table ;
So of course, the number of NULL columns is N - the result.