User breakdown by age

1

Please login or register to vote for this query.

(click on this box to dismiss)

Game Development Meta

Q&A about the site for professional and independent game developers

-- User breakdown by age

declare @total int
select @total = count(*) from users where reputation > 1;

declare @total_with_age int
select @total_with_age = count(*) from users where age is not null and reputation > 1;

select 0 "Bracket", count(*) "Count", round(100.0*count(*)/@total_with_age, 2) "% (aged)", round(100.0*count(*)/@total, 2) "% (total)" from users where age < 10 and reputation > 1
union all
select 10, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 10 and age < 20 and reputation > 1
union all
select 20, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 20 and age < 30 and reputation > 1
union all
select 30, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 30 and age < 40 and reputation > 1
union all
select 40, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 40 and age < 50 and reputation > 1
union all
select 50, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 50 and age < 60 and reputation > 1
union all
select 60, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 60 and age < 70 and reputation > 1
union all
select 70, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 70 and age < 80 and reputation > 1
union all
select 80, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 80 and age < 90 and reputation > 1
union all
select 90, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 90 and age < 100 and reputation > 1
union all
select 100, count(*), round(100.0*count(*)/@total_with_age, 2), round(100.0*count(*)/@total, 2) from users where age >= 100 and reputation > 1

Enter Parameters

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