Q&A about the site for power users of web applications
SELECT CONCAT(YEAR(CreationDate),'-',MONTH(CreationDate),'-',DAY(CreationDate)) AS creation_date, COUNT(CASE WHEN PostTypeId = 1 THEN PostTypeId ELSE NULL END) AS daily_questions, COUNT(CASE WHEN PostTypeId = 2 THEN PostTypeId ELSE NULL END) AS daily_answers, COUNT(CASE WHEN PostTypeId = 1 AND DeletionDate is null THEN PostTypeId ELSE NULL END) AS daily_questions_undeleted, COUNT(CASE WHEN PostTypeId = 2 AND DeletionDate is null THEN PostTypeId ELSE NULL END) AS daily_answers_undeleted FROM PostsWithDeleted WHERE YEAR(CreationDate) in (2020,2021,2022,2023,2024) GROUP BY YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate) ORDER BY YEAR(CreationDate), MONTH(CreationDate), DAY(CreationDate)