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,
"league_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,
"height" INT,
PRIMARY KEY ("id")
);

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



INSERT INTO "Country" VALUES ("1", "Italy");
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", "Player A", "180");
INSERT INTO "Player" VALUES ("2", "1002", "Player B", "175");
INSERT INTO "Player" VALUES ("3", "1003", "Player C", "185");
INSERT INTO "Player" VALUES ("4", "1004", "Player D", "190");
INSERT INTO "Player" VALUES ("5", "1005", "Player E", "170");
INSERT INTO "Player" VALUES ("6", "1006", "Player F", "182");
INSERT INTO "Player" VALUES ("7", "1007", "Player G", "178");
INSERT INTO "Player" VALUES ("8", "1008", "Player H", "188");
INSERT INTO "Player" VALUES ("9", "1009", "Player I", "192");
INSERT INTO "Player" VALUES ("10", "1010", "Player J", "173");
INSERT INTO "Player" VALUES ("11", "1011", "Player K", "181");
INSERT INTO "Player" VALUES ("12", "1012", "Player L", "176");
INSERT INTO "Player" VALUES ("13", "1013", "Player M", "183");
INSERT INTO "Player" VALUES ("14", "1014", "Player N", "187");
INSERT INTO "Player" VALUES ("15", "1015", "Player O", "179");
INSERT INTO "Player" VALUES ("16", "1016", "Player P", "184");
INSERT INTO "Player" VALUES ("17", "1017", "Player Q", "177");
INSERT INTO "Player" VALUES ("18", "1018", "Player R", "186");
INSERT INTO "Player" VALUES ("19", "1019", "Player S", "191");
INSERT INTO "Player" VALUES ("20", "1020", "Player T", "172");
INSERT INTO "Player" VALUES ("21", "1021", "Player U", "180");
INSERT INTO "Player" VALUES ("22", "1022", "Player V", "175");
INSERT INTO "Match" VALUES ("1", "1", "10", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Match" VALUES ("2", "1", "10", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1001", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Match" VALUES ("3", "2", "20", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Match" VALUES ("4", "1", "10", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1001", "1002", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Match" VALUES ("5", "3", "30", "1001", "1002", "1003", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Match" VALUES ("6", "1", "10", "1004", "1005", "1006", "1007", "1008", "1009", "1010", "1011", "1012", "1013", "1014", "1001", "1002", "1003", "1015", "1016", "1017", "1018", "1019", "1020", "1021", "1022");
INSERT INTO "Team" VALUES ("1", "Team A");
INSERT INTO "Team" VALUES ("2", "Team B");
INSERT INTO "Team" VALUES ("3", "Team C");
INSERT INTO "Team" VALUES ("4", "Team D");
INSERT INTO "Team" VALUES ("5", "Team E");