--- Yo dawg, I heard you liked stats...
-
--- count of games for the given year
-select date_part('month', create_dt), count(*)
-from games
-where date_part('year', create_dt) = 2012
-group by date_part('month', create_dt)
-order by date_part('month', create_dt);
-
--- count of game types for the given year
-select game_type_cd, count(*)
-from games
-where date_part('year', create_dt) = 2012
-group by game_type_cd
-order by count(*) desc;
-
--- count of unique players playing in the given month
-select date_part('month', create_dt), count(distinct player_id)
-from player_game_stats
-where date_part('year', create_dt) = 2012
-group by date_part('month', create_dt)
-order by date_part('month', create_dt);
-
--- count of servers with the most games
-select servers.name, count(*)
-from servers, games
-where servers.server_id = games.server_id
-and date_part('year', games.create_dt) = 2012
-group by servers.name
-order by count(*) desc;
-
--- count of maps with the most games
-select maps.name, count(*)
-from games, maps
-where maps.map_id = games.map_id
-and date_part('year', games.create_dt) = 2012
-group by maps.name
-order by count(*) desc;
-
--- new players by month
-select date_part('month', create_dt), count(*)
-from players
-where date_part('year', create_dt) = 2012
-group by date_part('month', create_dt)
-order by date_part('month', create_dt);
+-- count of games for the given year\r
+select date_part('month', create_dt), count(*) \r
+from games \r
+where date_part('year', create_dt) = 2012 \r
+group by date_part('month', create_dt) \r
+order by date_part('month', create_dt);\r
+\r
+-- count of game types for the given year\r
+select game_type_cd, count(*) \r
+from games \r
+where date_part('year', create_dt) = 2012 \r
+group by game_type_cd \r
+order by count(*) desc;\r
+\r
+-- count of unique players playing in the given month\r
+select date_part('month', create_dt), count(distinct player_id)\r
+from player_game_stats\r
+where date_part('year', create_dt) = 2012 \r
+group by date_part('month', create_dt) \r
+order by date_part('month', create_dt);\r
+\r
+-- count of servers with the most games\r
+select servers.name, count(*)\r
+from servers, games\r
+where servers.server_id = games.server_id\r
+and date_part('year', games.create_dt) = 2012 \r
+group by servers.name\r
+order by count(*) desc;\r
+\r
+-- count of maps with the most games\r
+select maps.name, count(*)\r
+from games, maps\r
+where maps.map_id = games.map_id\r
+and date_part('year', games.create_dt) = 2012 \r
+group by maps.name\r
+order by count(*) desc;\r
+\r
+-- new players by month\r
+select date_part('month', create_dt), count(*)\r
+from players\r
+where date_part('year', create_dt) = 2012\r
+group by date_part('month', create_dt)\r
+order by date_part('month', create_dt);\r