PRAGMA foreign_keys = ON;

PRAGMA writable_schema = 1;
DELETE FROM sqlite_master WHERE type IN ("table", "index", "trigger");
PRAGMA writable_schema = 0;
VACUUM;

CREATE TABLE "League" (
"id" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Match" (
"id" INT,
"league_id" INT,
"date" TEXT,
"home_team_api_id" INT,
"away_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("id")
);

CREATE TABLE "Team" (
"id" INT,
"team_long_name" TEXT,
PRIMARY KEY ("id")
);



INSERT INTO "League" VALUES ("1", "Belgium Jupiler League");
INSERT INTO "League" VALUES ("2", "England Premier League");
INSERT INTO "League" VALUES ("3", "Spain La Liga");
INSERT INTO "League" VALUES ("4", "Italy Serie A");
INSERT INTO "Match" VALUES ("1", "1", "2009-04-01", "101", "102");
INSERT INTO "Match" VALUES ("2", "1", "2009-04-15", "103", "104");
INSERT INTO "Match" VALUES ("3", "1", "2009-03-20", "101", "103");
INSERT INTO "Match" VALUES ("4", "1", "2009-05-05", "102", "104");
INSERT INTO "Match" VALUES ("5", "2", "2009-04-10", "201", "202");
INSERT INTO "Match" VALUES ("6", "1", "2009-04-25", "104", "101");
INSERT INTO "Match" VALUES ("7", "1", "2009-04-05", "102", "103");
INSERT INTO "Match" VALUES ("8", "3", "2009-04-01", "301", "302");
INSERT INTO "Match" VALUES ("9", "1", "2010-04-01", "101", "102");
INSERT INTO "Match" VALUES ("10", "1", "2009-04-30", "103", "104");
INSERT INTO "Team" VALUES ("101", "Standard Liege");
INSERT INTO "Team" VALUES ("102", "Club Brugge");
INSERT INTO "Team" VALUES ("103", "RSC Anderlecht");
INSERT INTO "Team" VALUES ("104", "KAA Gent");
INSERT INTO "Team" VALUES ("201", "Manchester United");
INSERT INTO "Team" VALUES ("202", "Liverpool");
INSERT INTO "Team" VALUES ("301", "Real Madrid");
INSERT INTO "Team" VALUES ("302", "Barcelona");