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,
"league_id" INT,
"date" TEXT,
"home_team_goal" INT,
"away_team_goal" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("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", "Spain");
INSERT INTO "Country" VALUES ("4", "Germany");
INSERT INTO "League" VALUES ("101", "1", "Eredivisie");
INSERT INTO "League" VALUES ("102", "2", "Premier League");
INSERT INTO "League" VALUES ("103", "3", "La Liga");
INSERT INTO "League" VALUES ("104", "4", "Bundesliga");
INSERT INTO "Match" VALUES ("1", "101", "2023-01-15", "3", "1");
INSERT INTO "Match" VALUES ("2", "101", "2023-01-22", "5", "2");
INSERT INTO "Match" VALUES ("3", "101", "2023-01-29", "0", "0");
INSERT INTO "Match" VALUES ("4", "101", "2023-02-05", "7", "3");
INSERT INTO "Match" VALUES ("5", "101", "2023-02-12", "2", "4");
INSERT INTO "Match" VALUES ("6", "102", "2023-01-15", "4", "0");
INSERT INTO "Match" VALUES ("7", "103", "2023-01-15", "6", "1");
INSERT INTO "Match" VALUES ("8", "101", "2023-03-01", "1", "0");
INSERT INTO "Match" VALUES ("9", "101", "2023-03-08", "8", "2");
INSERT INTO "Match" VALUES ("10", "101", "2023-03-15", "5", "5");
INSERT INTO "Team" VALUES ("1", "Ajax");
INSERT INTO "Team" VALUES ("2", "PSV");
INSERT INTO "Team" VALUES ("3", "Feyenoord");
INSERT INTO "Team" VALUES ("4", "AZ Alkmaar");
INSERT INTO "Team" VALUES ("5", "FC Twente");
INSERT INTO "Team" VALUES ("6", "Manchester United");
INSERT INTO "Team" VALUES ("7", "Real Madrid");