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

CREATE TABLE "Match" (
"id" INT,
"country_id" INT,
"league_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", "England");
INSERT INTO "Country" VALUES ("2", "Spain");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "Country" VALUES ("4", "Italy");
INSERT INTO "Country" VALUES ("5", "France");
INSERT INTO "Country" VALUES ("6", "Poland");
INSERT INTO "Country" VALUES ("7", "Portugal");
INSERT INTO "League" VALUES ("101", "1", "Premier League");
INSERT INTO "League" VALUES ("102", "2", "La Liga");
INSERT INTO "League" VALUES ("103", "3", "Bundesliga");
INSERT INTO "League" VALUES ("104", "4", "Serie A");
INSERT INTO "League" VALUES ("105", "5", "Ligue 1");
INSERT INTO "League" VALUES ("106", "6", "Poland Ekstraklasa");
INSERT INTO "League" VALUES ("107", "7", "Primeira Liga");
INSERT INTO "League" VALUES ("108", "1", "Championship");
INSERT INTO "League" VALUES ("109", "2", "Segunda Division");
INSERT INTO "Match" VALUES ("1", "1", "101");
INSERT INTO "Match" VALUES ("2", "2", "102");
INSERT INTO "Match" VALUES ("3", "6", "106");
INSERT INTO "Match" VALUES ("4", "1", "101");
INSERT INTO "Match" VALUES ("5", "3", "103");
INSERT INTO "Match" VALUES ("6", "6", "106");
INSERT INTO "Match" VALUES ("7", "4", "104");
INSERT INTO "Match" VALUES ("8", "5", "105");
INSERT INTO "Match" VALUES ("9", "7", "107");
INSERT INTO "Match" VALUES ("10", "1", "108");
INSERT INTO "Team" VALUES ("1001", "Manchester United");
INSERT INTO "Team" VALUES ("1002", "Real Madrid");
INSERT INTO "Team" VALUES ("1003", "Bayern Munich");
INSERT INTO "Team" VALUES ("1004", "Juventus");
INSERT INTO "Team" VALUES ("1005", "Paris Saint-Germain");
INSERT INTO "Team" VALUES ("1006", "Legia Warsaw");
INSERT INTO "Team" VALUES ("1007", "FC Porto");
INSERT INTO "Team" VALUES ("1008", "Liverpool");
INSERT INTO "Team" VALUES ("1009", "Barcelona");
INSERT INTO "Team" VALUES ("1010", "Borussia Dortmund");