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

CREATE TABLE "Match" (
"id" INT,
"country_id" INT,
"league_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 ("league_id") REFERENCES "League"("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 "Player_Attributes" (
"id" INT,
"player_api_id" INT,
"overall_rating" INT,
"potential" INT,
"vision" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);

CREATE TABLE "Team_Attributes" (
"id" INT,
"buildUpPlaySpeed" INT,
PRIMARY KEY ("id")
);



INSERT INTO "Country" VALUES ("1", "England");
INSERT INTO "Country" VALUES ("2", "Spain");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "Country" VALUES ("4", "Italy");
INSERT INTO "Country" VALUES ("5", "France");
INSERT INTO "League" VALUES ("1001", "1");
INSERT INTO "League" VALUES ("1002", "2");
INSERT INTO "League" VALUES ("1003", "3");
INSERT INTO "League" VALUES ("1004", "4");
INSERT INTO "League" VALUES ("1005", "5");
INSERT INTO "Player" VALUES ("1", "101", "Player A");
INSERT INTO "Player" VALUES ("2", "102", "Player B");
INSERT INTO "Player" VALUES ("3", "103", "Player C");
INSERT INTO "Player" VALUES ("4", "104", "Player D");
INSERT INTO "Player" VALUES ("5", "105", "Player E");
INSERT INTO "Player" VALUES ("6", "106", "Player F");
INSERT INTO "Player" VALUES ("7", "107", "Player G");
INSERT INTO "Player" VALUES ("8", "108", "Player H");
INSERT INTO "Player" VALUES ("9", "109", "Player I");
INSERT INTO "Player" VALUES ("10", "110", "Player J");
INSERT INTO "Player" VALUES ("11", "111", "Player K");
INSERT INTO "Player" VALUES ("12", "112", "Player L");
INSERT INTO "Player" VALUES ("13", "113", "Player M");
INSERT INTO "Player" VALUES ("14", "114", "Player N");
INSERT INTO "Player" VALUES ("15", "115", "Player O");
INSERT INTO "Player" VALUES ("16", "116", "Player P");
INSERT INTO "Player" VALUES ("17", "117", "Player Q");
INSERT INTO "Player" VALUES ("18", "118", "Player R");
INSERT INTO "Player" VALUES ("19", "119", "Player S");
INSERT INTO "Player" VALUES ("20", "120", "Player T");
INSERT INTO "Player" VALUES ("21", "121", "Player U");
INSERT INTO "Player" VALUES ("22", "122", "Player V");
INSERT INTO "Player_Attributes" VALUES ("1", "101", "85", "90", "92");
INSERT INTO "Player_Attributes" VALUES ("2", "102", "88", "91", "89");
INSERT INTO "Player_Attributes" VALUES ("3", "103", "80", "85", "90");
INSERT INTO "Player_Attributes" VALUES ("4", "104", "75", "80", "85");
INSERT INTO "Player_Attributes" VALUES ("5", "105", "90", "95", "93");
INSERT INTO "Player_Attributes" VALUES ("6", "106", "82", "87", "88");
INSERT INTO "Player_Attributes" VALUES ("7", "107", "78", "83", "91");
INSERT INTO "Player_Attributes" VALUES ("8", "108", "86", "90", "87");
INSERT INTO "Player_Attributes" VALUES ("9", "109", "89", "92", "94");
INSERT INTO "Player_Attributes" VALUES ("10", "110", "70", "75", "70");
INSERT INTO "Player_Attributes" VALUES ("11", "111", "91", "94", "90");
INSERT INTO "Player_Attributes" VALUES ("12", "112", "83", "88", "89");
INSERT INTO "Player_Attributes" VALUES ("13", "113", "79", "84", "92");
INSERT INTO "Player_Attributes" VALUES ("14", "114", "87", "91", "88");
INSERT INTO "Player_Attributes" VALUES ("15", "115", "92", "96", "95");
INSERT INTO "Player_Attributes" VALUES ("16", "116", "81", "86", "87");
INSERT INTO "Player_Attributes" VALUES ("17", "117", "77", "82", "90");
INSERT INTO "Player_Attributes" VALUES ("18", "118", "84", "89", "86");
INSERT INTO "Player_Attributes" VALUES ("19", "119", "90", "93", "91");
INSERT INTO "Player_Attributes" VALUES ("20", "120", "72", "77", "75");
INSERT INTO "Player_Attributes" VALUES ("21", "121", "85", "90", "93");
INSERT INTO "Player_Attributes" VALUES ("22", "122", "88", "92", "89");
INSERT INTO "Match" VALUES ("1", "1", "1001", "201", "202", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122");
INSERT INTO "Match" VALUES ("2", "2", "1002", "203", "204", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122");
INSERT INTO "Match" VALUES ("3", "3", "1003", "205", "206", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122");
INSERT INTO "Match" VALUES ("4", "4", "1004", "207", "208", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122");
INSERT INTO "Match" VALUES ("5", "5", "1005", "209", "210", "101", "102", "103", "104", "105", "106", "107", "108", "109", "110", "111", "112", "113", "114", "115", "116", "117", "118", "119", "120", "121", "122");
INSERT INTO "Team_Attributes" VALUES ("1", "60");
INSERT INTO "Team_Attributes" VALUES ("2", "70");
INSERT INTO "Team_Attributes" VALUES ("3", "65");
INSERT INTO "Team_Attributes" VALUES ("4", "75");
INSERT INTO "Team_Attributes" VALUES ("5", "80");