group by field_name is null
select count(*),is_null from (
select case when columnName is null then 'null' else 'not null' end as is_null
from tableName
) t group by is_null;
group by case when my_field is null then 0 else 1 end
Find more questions by tags SQLPostgreSQL