I am using a PostgreSQL table that has 800+ columns. I need to determine which columns have 100% population. I have two fields that I know are fully populated but I need to determine if there are others.
I can get a list of the columns in the table using
select column_name
from information_schema.columns
where table_name = 'projectmeasures'
I just don’t know how to use this to loop through each column to determine count(column_name) / count(*)
2
Answers
You could use PL/pgSQL code like this to generate a query that tells you which columns contain no NULL values:
To list columns that have no null values:
To list columns that have some null values: