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 "Match" (
"id" INT,
"league_id" INT,
"home_team_api_id" INT,
"away_team_api_id" INT,
"home_team_goal" INT,
"away_team_goal" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("away_team_api_id") REFERENCES "Team"("team_api_id"),
FOREIGN KEY ("home_team_api_id") REFERENCES "Team"("team_api_id")
);

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



INSERT INTO "Team" VALUES ("1", "1001", "Manchester United FC");
INSERT INTO "Team" VALUES ("2", "1002", "Real Madrid CF");
INSERT INTO "Team" VALUES ("3", "1003", "FC Barcelona");
INSERT INTO "Team" VALUES ("4", "1004", "Bayern Munich");
INSERT INTO "Team" VALUES ("5", "1005", "Juventus FC");
INSERT INTO "Team" VALUES ("6", "1006", "Paris Saint-Germain");
INSERT INTO "Team" VALUES ("7", "1007", "Liverpool FC");
INSERT INTO "Team" VALUES ("8", "1008", "Chelsea FC");
INSERT INTO "Match" VALUES ("1", "10", "1001", "1002", "2", "3");
INSERT INTO "Match" VALUES ("2", "10", "1003", "1004", "1", "1");
INSERT INTO "Match" VALUES ("3", "10", "1005", "1006", "0", "5");
INSERT INTO "Match" VALUES ("4", "10", "1007", "1008", "3", "2");
INSERT INTO "Match" VALUES ("5", "10", "1002", "1003", "2", "2");
INSERT INTO "Match" VALUES ("6", "10", "1004", "1005", "1", "4");
INSERT INTO "Match" VALUES ("7", "10", "1006", "1007", "0", "0");
INSERT INTO "Match" VALUES ("8", "10", "1008", "1001", "1", "1");
INSERT INTO "Match" VALUES ("9", "10", "1001", "1006", "2", "5");
INSERT INTO "Match" VALUES ("10", "10", "1003", "1002", "0", "3");