Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Open Sports Data (sport.db) Web Site
CSS
tree: 532d15695c

Fetching latest commit…

Cannot retrieve the latest commit at this time

Failed to load latest commit information.
db
script
.gitignore
README.md
sport.db
sport.sql

README.md

Welcome to sport.db

A Free Open Sports Database & Schema

Usage

Get a copy of the sport.db file. That's it.

Events

Football (Soccer)

International w/ national teams (e.g. Austria, England, etc.)

International w/ football club teams (e.g. FC Barcelona, Manchester Utd, etc.)

National leagues & cups w/ football club teams

Hockey

Hockey club teams

Anything missing? Add your leagues, teams, fixtures and more.

Demo

Try the sport.db Web Admin demo running on Heroku sportdbdemo.herokuapp.com.

Tables, Schema

The sport.db includes the following tables:

  • teams
  • games
  • events
    • events_teams (join table)
  • rounds
  • groups
    • groups_teams (join table)

[add schema pic here]

teams Table

[tbd]

CREATE TABLE teams ( 
    id         INTEGER         PRIMARY KEY AUTOINCREMENT NOT NULL,
    title      VARCHAR( 255 )  NOT NULL,
    title2     VARCHAR( 255 ),
    [key]      VARCHAR( 255 )  NOT NULL,
    tag        VARCHAR( 255 ),
    created_at DATETIME        NOT NULL,
    updated_at DATETIME        NOT NULL 
);

games Table

[tbd]

CREATE TABLE games ( 
    id           INTEGER         PRIMARY KEY AUTOINCREMENT NOT NULL,
    round_id     INTEGER         NOT NULL,
    pos          INTEGER         NOT NULL,
    group_id     INTEGER,
    team1_id     INTEGER         NOT NULL,
    team2_id     INTEGER         NOT NULL,
    play_at      DATETIME        NOT NULL,
    knockout     BOOLEAN         DEFAULT 'f'   NOT NULL,
    home         BOOLEAN         DEFAULT 't'   NOT NULL,
    score1       INTEGER,
    score2       INTEGER,
    score3       INTEGER,
    score4       INTEGER,
    score5       INTEGER,
    score6       INTEGER,
    next_game_id INTEGER,
    prev_game_id INTEGER,
    toto12x      VARCHAR( 255 ),
    [key]        VARCHAR( 255 ),
    created_at   DATETIME        NOT NULL,
    updated_at   DATETIME        NOT NULL 
);

events Table

[tbd]

CREATE TABLE events ( 
    id         INTEGER         PRIMARY KEY AUTOINCREMENT NOT NULL,
    title      VARCHAR( 255 )  NOT NULL,
    [key]      VARCHAR( 255 )  NOT NULL,
    start_at   DATETIME        NOT NULL,
    created_at DATETIME        NOT NULL,
    updated_at DATETIME        NOT NULL 
);

Command Line Tool

sportdb - sport.db command line tool

Usage: sportdb [options]
  -c, --create                     Create DB Schema
      --load                       Use Loader for Builtin Sports Data
  -o, --output PATH                Output Path (default is .)
  -i, --include PATH               Data Path (default is .)
  -v, --version                    Show version
      --verbose                    Show debug trace
  -h, --help                       Show this message


Examples:
   sportdb cl/teams cl/2012_13/cl                     # import champions league (cl)
   sportdb -c                                         # create database schema

See the sportdb command line tool documentation for more.

Build Your Own sport.db Version

Step 1: Create an empty database, that is, sport.db. Issue the command:

sportdb --create

Step 2: Add your events and game fixtures of choice. For example, let's use the Champions League 2012/13 and the World Cup 2012/13 Quali events and fixtures:

sportdb --include <your_path_to_fixtures> cl/teams cl/2012_13/cl
sportdb --include <your_path_to_fixtures> euro/teams world/2012_13/quali_2012_13

That's it.

Real World Usage

sport.db Web Admin - sport.db Web Admin Tool in Ruby on Rails (version 3.2 and up).

Sportbook - A free, open source sports betting pool in Ruby on Rails (version 3.2 and up).

Alternatives

SportsDB - open database schema for sports information (formerly known as XTOSS: The XML Team Open Sports Schema.)

openLigaDB - community-based sport results

License

The sport.db schema, data and scripts are dedicated to the public domain. Use it as you please with no restrictions whatsoever.

Questions? Comments?

Send them along to the Open Sports Database & Friends Forum/Mailing List. Thanks!

Something went wrong with that request. Please try again.