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 "Match" (
"id" INT,
"country_id" INT,
"home_team_api_id" INT,
"away_team_api_id" INT,
"home_player_1" INT,
"home_player_2" INT,
"home_player_3" INT,
"home_player_4" INT,
"home_player_5" INT,
"home_player_6" INT,
"home_player_7" INT,
"home_player_8" INT,
"home_player_9" INT,
"home_player_10" INT,
"home_player_11" INT,
"away_player_1" INT,
"away_player_2" INT,
"away_player_3" INT,
"away_player_4" INT,
"away_player_5" INT,
"away_player_6" INT,
"away_player_7" INT,
"away_player_8" INT,
"away_player_9" INT,
"away_player_10" INT,
"away_player_11" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("away_player_11") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_10") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_9") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_8") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_7") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_6") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_5") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_4") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_3") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_2") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("away_player_1") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_11") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_10") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_9") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_8") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_7") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_6") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_5") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_4") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_3") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_2") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_1") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("id")
);

CREATE TABLE "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
PRIMARY KEY ("id")
);

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



INSERT INTO "Country" VALUES ("1", "Belgium");
INSERT INTO "Country" VALUES ("2", "England");
INSERT INTO "Country" VALUES ("3", "Spain");
INSERT INTO "Country" VALUES ("4", "Germany");
INSERT INTO "Country" VALUES ("5", "France");
INSERT INTO "Player" VALUES ("1", "1001", "Kevin De Bruyne");
INSERT INTO "Player" VALUES ("2", "1002", "Eden Hazard");
INSERT INTO "Player" VALUES ("3", "1003", "Romelu Lukaku");
INSERT INTO "Player" VALUES ("4", "1004", "Thibaut Courtois");
INSERT INTO "Player" VALUES ("5", "1005", "Vincent Kompany");
INSERT INTO "Player" VALUES ("6", "2001", "Harry Kane");
INSERT INTO "Player" VALUES ("7", "2002", "Raheem Sterling");
INSERT INTO "Player" VALUES ("8", "3001", "Lionel Messi");
INSERT INTO "Player" VALUES ("9", "3002", "Sergio Ramos");
INSERT INTO "Player" VALUES ("10", "4001", "Manuel Neuer");
INSERT INTO "Player" VALUES ("11", "5001", "Kylian Mbappe");
INSERT INTO "Team" VALUES ("1", "Manchester City");
INSERT INTO "Team" VALUES ("2", "Real Madrid");
INSERT INTO "Team" VALUES ("3", "Chelsea");
INSERT INTO "Team" VALUES ("4", "Barcelona");
INSERT INTO "Team" VALUES ("5", "Bayern Munich");
INSERT INTO "Match" VALUES ("1", "2", "1", "3", "1001", "2001", "2002", "1005", "1004", "1002", "1003", "1001", "2001", "2002", "1005", "1002", "1003", "1004", "1005", "2001", "2002", "1001", "1002", "1003", "1004", "1005");
INSERT INTO "Match" VALUES ("2", "3", "4", "2", "3001", "3002", "1001", "1002", "1003", "1004", "1005", "2001", "2002", "3001", "3002", "1001", "1002", "1003", "1004", "1005", "2001", "2002", "3001", "3002", "4001", "5001");
INSERT INTO "Match" VALUES ("3", "4", "5", "1", "4001", "1001", "1002", "1003", "1004", "1005", "2001", "2002", "3001", "3002", "4001", "1001", "1002", "1003", "1004", "1005", "2001", "2002", "3001", "3002", "4001", "5001");