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,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("id")
);



INSERT INTO "Country" VALUES ("1", "Germany");
INSERT INTO "Country" VALUES ("2", "France");
INSERT INTO "Country" VALUES ("3", "Spain");
INSERT INTO "Country" VALUES ("4", "Italy");
INSERT INTO "Country" VALUES ("5", "England");
INSERT INTO "League" VALUES ("1", "1", "Bundesliga");
INSERT INTO "League" VALUES ("2", "1", "2. Bundesliga");
INSERT INTO "League" VALUES ("3", "1", "3. Liga");
INSERT INTO "League" VALUES ("4", "2", "Ligue 1");
INSERT INTO "League" VALUES ("5", "2", "Ligue 2");
INSERT INTO "League" VALUES ("6", "3", "La Liga");
INSERT INTO "League" VALUES ("7", "3", "Segunda División");
INSERT INTO "League" VALUES ("8", "4", "Serie A");
INSERT INTO "League" VALUES ("9", "4", "Serie B");
INSERT INTO "League" VALUES ("10", "5", "Premier League");
INSERT INTO "League" VALUES ("11", "5", "Championship");
INSERT INTO "Match" VALUES ("1", "1", "1", "2022/2023");
INSERT INTO "Match" VALUES ("2", "1", "1", "2021/2022");
INSERT INTO "Match" VALUES ("3", "1", "2", "2022/2023");
INSERT INTO "Match" VALUES ("4", "1", "3", "2022/2023");
INSERT INTO "Match" VALUES ("5", "2", "4", "2022/2023");
INSERT INTO "Match" VALUES ("6", "2", "5", "2021/2022");
INSERT INTO "Match" VALUES ("7", "3", "6", "2022/2023");
INSERT INTO "Match" VALUES ("8", "3", "7", "2021/2022");
INSERT INTO "Match" VALUES ("9", "4", "8", "2022/2023");
INSERT INTO "Match" VALUES ("10", "4", "9", "2021/2022");
INSERT INTO "Match" VALUES ("11", "5", "10", "2022/2023");
INSERT INTO "Match" VALUES ("12", "5", "11", "2021/2022");
INSERT INTO "Match" VALUES ("13", "1", "1", "2020/2021");
INSERT INTO "Match" VALUES ("14", "1", "2", "2020/2021");
INSERT INTO "Match" VALUES ("15", "1", "3", "2020/2021");