Q&A for gamemasters and players of tabletop, paper-and-pencil role-playing games
/* Which questions are most popular? Who, what, when, where, why, how? */ with q_types as ( select id, case when lower(title) like 'who %' then 'Who' when lower(title) like 'what %' then 'What' when lower(title) like 'when %' then 'When' when lower(title) like 'where %' then 'Where' when lower(title) like 'why %' then 'Why' when lower(title) like 'how %' then 'How' else 'Unknown' end as q_type from posts where posttypeid in (select id from posttypes where name = 'Question') ) select q_type, count(id) from q_types group by q_type ;