Count per week per column PostgreSQL Let's say I have a PostgreSQL table with 10 columns and 2 weeks (w1 w2) with 5 countries. Something that would look like this : 



What I would like to do is a count per week and per column like this :
As count() counts only the non-NULL values, this is a simple GROUP BY query:

SELECT week, count(col1), ..., count(col10)
  FROM your_table
 GROUP BY week;