1 -- Yo dawg, I heard you liked stats...
3 -- count of games for the given year
4 select date_part('month', create_dt), count(*)
6 where date_part('year', create_dt) = 2012
7 group by date_part('month', create_dt)
8 order by date_part('month', create_dt);
10 -- count of game types for the given year
11 select game_type_cd, count(*)
13 where date_part('year', create_dt) = 2012
15 order by count(*) desc;
17 -- count of unique players playing in the given month
18 select date_part('month', create_dt), count(distinct player_id)
19 from player_game_stats
20 where date_part('year', create_dt) = 2012
21 group by date_part('month', create_dt)
22 order by date_part('month', create_dt);
24 -- count of servers with the most games
25 select servers.name, count(*)
27 where servers.server_id = games.server_id
28 and date_part('year', games.create_dt) = 2012
30 order by count(*) desc;
32 -- count of maps with the most games
33 select maps.name, count(*)
35 where maps.map_id = games.map_id
36 and date_part('year', games.create_dt) = 2012
38 order by count(*) desc;
40 -- new players by month
41 select date_part('month', create_dt), count(*)
43 where date_part('year', create_dt) = 2012
44 group by date_part('month', create_dt)
45 order by date_part('month', create_dt);