Q&A for professional and enthusiast programmers
-- Define a one-month period DECLARE @PeriodStart DATE = '2024-08-01'; DECLARE @PeriodEnd DATE = '2024-08-31'; -- Query for active users with simplified expertise levels, using 100% of data SELECT DATEFROMPARTS(YEAR(p.CreationDate), MONTH(p.CreationDate), 1) AS ActivityMonth, CASE WHEN u.Reputation < 1000 THEN 'Beginner' WHEN u.Reputation BETWEEN 1000 AND 9999 THEN 'Intermediate' ELSE 'Expert' END AS ExpertiseLevel, COUNT(DISTINCT p.OwnerUserId) AS ActiveUsers FROM Posts p JOIN Users u ON p.OwnerUserId = u.Id WHERE p.CreationDate BETWEEN @PeriodStart AND @PeriodEnd AND p.OwnerUserId IS NOT NULL GROUP BY DATEFROMPARTS(YEAR(p.CreationDate), MONTH(p.CreationDate), 1), CASE WHEN u.Reputation < 1000 THEN 'Beginner' WHEN u.Reputation BETWEEN 1000 AND 9999 THEN 'Intermediate' ELSE 'Expert' END ORDER BY ActivityMonth, ExpertiseLevel;