Jekyll Minimal Theme    Archive    Feed    About

football.db SQL Queries Made Easy (Thanks to Views)

First thanks to Joe Kampschmidt for getting started w/ some SQL queries examples.

Added some SQL views to make it easier to query the football.db. Example - List World Cup Brazil 2014 Games:

Before (Table Edition):

SELECT t1.title, 
  FROM games g 
       LEFT OUTER JOIN teams t1 ON = g.team1_id 
       LEFT OUTER JOIN teams t2 ON = g.team2_id 
       INNER JOIN rounds r ON = g.round_id 
       INNER JOIN events e ON = r.event_id 
 WHERE e.key = 'world.2014' 

After (View Edition):

  FROM events_games_list 
 WHERE e.key = 'world.2014'; 

More views include:

  • teams_list
  • games_list
  • events_list
  • events_teams_list
  • events_games_list
  • events_rounds_list
  • events_groups_list