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_goal" INT,
"away_team_goal" 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", "Netherlands");
INSERT INTO "Country" VALUES ("2", "England");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "League" VALUES ("10", "1", "Eredivisie");
INSERT INTO "League" VALUES ("20", "2", "Premier League");
INSERT INTO "League" VALUES ("30", "3", "Bundesliga");
INSERT INTO "Team" VALUES ("100", "Ajax Amsterdam");
INSERT INTO "Team" VALUES ("101", "PSV Eindhoven");
INSERT INTO "Team" VALUES ("102", "Feyenoord Rotterdam");
INSERT INTO "Team" VALUES ("103", "Manchester United");
INSERT INTO "Team" VALUES ("104", "Liverpool FC");
INSERT INTO "Team" VALUES ("105", "Bayern Munich");
INSERT INTO "Match" VALUES ("1000", "1", "10", "2022/2023", "5", "2");
INSERT INTO "Match" VALUES ("1001", "1", "10", "2022/2023", "3", "3");
INSERT INTO "Match" VALUES ("1002", "1", "10", "2022/2023", "6", "1");
INSERT INTO "Match" VALUES ("1003", "1", "10", "2021/2022", "4", "0");
INSERT INTO "Match" VALUES ("1004", "1", "10", "2021/2022", "6", "4");
INSERT INTO "Match" VALUES ("1005", "2", "20", "2022/2023", "7", "1");
INSERT INTO "Match" VALUES ("1006", "3", "30", "2022/2023", "2", "2");
INSERT INTO "Match" VALUES ("1007", "1", "10", "2020/2021", "6", "5");
INSERT INTO "Match" VALUES ("1008", "1", "10", "2020/2021", "2", "3");
INSERT INTO "Match" VALUES ("1009", "1", "10", "2019/2020", "1", "0");