Age Distribution of Stack Overflow Contributors.

2

Please login or register to vote for this query.

(click on this box to dismiss)

by CraigTP. (Please note that some users do not have valid "ages"!)

Emacs

Q&A for those using, extending or developing Emacs

-- Age Distribution of Stack Overflow Contributors.
-- by CraigTP.
-- (Please note that some users do not have valid "ages"!)

WITH Breakdown AS
(SELECT
count(*) AS AgeCount,
Age,
Band = CASE WHEN Age <= 10 THEN '1-10'
WHEN Age > 10 AND Age <= 15 THEN '11-15'
WHEN Age > 15 AND Age <= 20 THEN '16-20'
WHEN Age > 20 AND Age <= 25 THEN '21-25'
WHEN Age > 25 AND Age <= 30 THEN '26-30'
WHEN Age > 30 AND Age <= 35 THEN '31-35'
WHEN Age > 35 AND Age <= 40 THEN '36-40'
WHEN Age > 40 AND Age <= 45 THEN '41-45'
WHEN Age > 45 AND Age <= 50 THEN '46-50'
WHEN Age > 50 AND Age <= 55 THEN '51-55'
WHEN Age > 55 AND Age <= 60 THEN '56-60'
WHEN Age > 60 AND Age <= 65 THEN '61-65'
WHEN Age > 65 AND Age <= 70 THEN '66-70'
WHEN Age > 70 THEN '71+'
END
from Users
WHERE Age IS NOT NULL
GROUP BY Age
)

SELECT
SUM(AgeCount) AS NumberOfUsers,
PercentageOfUsers = ROUND((CAST(SUM(AgeCount) as decimal) / CAST((SELECT SUM(AgeCount) FROM Breakdown) as decimal) * 100), 2),
Band AS AgeBracket
FROM Breakdown 
GROUP BY Band
ORDER BY Band

Enter Parameters

Options:
Switch to meta site
loading Hold tight while we fetch your results