Skip to content
Advertisement

Null. Empty and Filled count in a postgresql table

I need to count how many fields are null, empty and filled in a table. Where each column would be a field, for example:

(this is an exemple)

Does anyone have any idea how I can do this? This table has about 30 columns.

Advertisement

Answer

You can convert each row to a JSON value and then group by the keys of those json value (which are the column names):

Note that this is going to be much slower than manually listing every column like you did.

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement