]> de.git.xonotic.org Git - xonotic/xonstatdb.git/blob - scripts/dashboard_report.sql
Adding yo dawg, just for the hell of it.
[xonotic/xonstatdb.git] / scripts / dashboard_report.sql
1 -- Yo dawg, I heard you liked stats...
2
3 -- count of games for the given year
4 select date_part('month', create_dt), count(*) 
5 from games 
6 where date_part('year', create_dt) = 2012 
7 group by date_part('month', create_dt) 
8 order by date_part('month', create_dt);
9
10 -- count of game types for the given year
11 select game_type_cd, count(*) 
12 from games 
13 where date_part('year', create_dt) = 2012 
14 group by game_type_cd 
15 order by count(*) desc;
16
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);
23
24 -- count of servers with the most games
25 select servers.name, count(*)
26 from servers, games
27 where servers.server_id = games.server_id
28 and date_part('year', games.create_dt) = 2012 
29 group by servers.name
30 order by count(*) desc;
31
32 -- count of maps with the most games
33 select maps.name, count(*)
34 from games, maps
35 where maps.map_id = games.map_id
36 and date_part('year', games.create_dt) = 2012 
37 group by maps.name
38 order by count(*) desc;
39
40 -- new players by month
41 select date_part('month', create_dt), count(*)
42 from players
43 where date_part('year', create_dt) = 2012
44 group by date_part('month', create_dt)
45 order by date_part('month', create_dt);