Question: What is the percentage distribution of years of experience among People managers grouped into buckets of 5 years?
SQL:
SELECT CEIL(WorkExp / 5) * 5 AS bucket_start, CEIL(WorkExp / 5) * 5 + 4 AS bucket_end, COUNT(WorkExp) * 100.0 / (SELECT COUNT(WorkExp) FROM Responses WHERE IndividualContributorOrPeopleManager = 'People manager') AS count_in_bucket FROM Responses WHERE NOT WorkExp IS NULL AND IndividualContributorOrPeopleManager = 'People manager' GROUP BY CEIL(WorkExp / 5)
SELECT CASE WHEN WorkExp BETWEEN 0 AND 5 THEN '0-5' WHEN WorkExp BETWEEN 6 AND 10 THEN '6-10' WHEN WorkExp BETWEEN 11 AND 15 THEN '11-15' WHEN WorkExp BETWEEN 16 AND 20 THEN '16-20' WHEN WorkExp > 20 THEN '20+' END AS "Experience_Bucket", COUNT(*) * 100.0 / (SELECT COUNT(*) FROM Responses WHERE IndividualContributorOrPeopleManager = 'People manager' AND NOT WorkExp IS NULL) AS "Percentage" FROM Responses WHERE IndividualContributorOrPeopleManager = 'People manager' AND NOT WorkExp IS NULL GROUP BY Experience_Bucket