user/rep/age summary

0

Please login or register to vote for this query.

(click on this box to dismiss)

Computational Science

Q&A for scientists using computers to solve scientific problems

select agegroup, count(*) programmers, sum(reputation) reputation, min(cast(reputation as FLOAT)) min_reputation,  avg(cast(reputation as FLOAT)) avg_reputation, max(cast(reputation as FLOAT)) max_reputation, stdev(cast(reputation as FLOAT)) stdev_reputation 
from 
(select *, 
agegroup = CASE
  WHEN age >= 15 and age <= 19 THEN '15-19'
  WHEN age >= 20 and age <= 24 THEN '20-24'
  WHEN age >= 25 and age <= 29 THEN '25-29'
  WHEN age >= 30 and age <= 34 THEN '30-34'
  WHEN age >= 35 and age <= 39 THEN '35-39'
  WHEN age >= 40 and age <= 44 THEN '40-44'
  WHEN age >= 45 and age <= 49 THEN '45-49'
  WHEN age >= 50 and age <= 54 THEN '50-54'
  WHEN age >= 55 and age <= 59 THEN '55-59'
  WHEN age >= 60 and age <= 64 THEN '60-64'
  WHEN age >= 65 and age <= 69 THEN '65-69'
  END 
  from users) agusers
where age is not null 
and age between 18 and 70
and agusers.id in (select users.id from users, posts answers where answers.posttypeid=2
and agusers.id=answers.owneruserid and year(answers.creationdate)=2012)
and agusers.reputation > 1000
group by agegroup
order by agegroup

Enter Parameters

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