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 "Country" (
"id" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("id")
);

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

CREATE TABLE "Match" (
"id" INT,
"country_id" INT,
"league_id" INT,
"season" TEXT,
"home_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("id")
);

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



INSERT INTO "Country" VALUES ("1", "Italy");
INSERT INTO "Country" VALUES ("2", "England");
INSERT INTO "Country" VALUES ("3", "Spain");
INSERT INTO "League" VALUES ("10", "1", "Serie A");
INSERT INTO "League" VALUES ("20", "2", "Premier League");
INSERT INTO "League" VALUES ("30", "3", "La Liga");
INSERT INTO "Team" VALUES ("100", "Juventus FC");
INSERT INTO "Team" VALUES ("101", "AC Milan");
INSERT INTO "Team" VALUES ("102", "Inter Milan");
INSERT INTO "Team" VALUES ("103", "AS Roma");
INSERT INTO "Team" VALUES ("104", "Napoli");
INSERT INTO "Team" VALUES ("105", "Chelsea FC");
INSERT INTO "Team" VALUES ("106", "Manchester United");
INSERT INTO "Team" VALUES ("107", "Real Madrid");
INSERT INTO "Team" VALUES ("108", "FC Barcelona");
INSERT INTO "Match" VALUES ("1000", "1", "10", "2015/2016", "100");
INSERT INTO "Match" VALUES ("1001", "1", "10", "2015/2016", "101");
INSERT INTO "Match" VALUES ("1002", "1", "10", "2015/2016", "102");
INSERT INTO "Match" VALUES ("1003", "1", "10", "2015/2016", "103");
INSERT INTO "Match" VALUES ("1004", "1", "10", "2015/2016", "104");
INSERT INTO "Match" VALUES ("1005", "1", "10", "2015/2016", "100");
INSERT INTO "Match" VALUES ("1006", "1", "10", "2015/2016", "101");
INSERT INTO "Match" VALUES ("1007", "1", "10", "2015/2016", "102");
INSERT INTO "Match" VALUES ("1008", "1", "10", "2015/2016", "103");
INSERT INTO "Match" VALUES ("1009", "1", "10", "2015/2016", "104");
INSERT INTO "Match" VALUES ("1010", "1", "10", "2014/2015", "100");
INSERT INTO "Match" VALUES ("1011", "1", "10", "2016/2017", "101");
INSERT INTO "Match" VALUES ("2000", "2", "20", "2015/2016", "105");
INSERT INTO "Match" VALUES ("2001", "2", "20", "2015/2016", "106");
INSERT INTO "Match" VALUES ("3000", "3", "30", "2015/2016", "107");
INSERT INTO "Match" VALUES ("3001", "3", "30", "2015/2016", "108");