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 "Match" (
"id" INT,
"home_team_api_id" INT,
"home_team_goal" INT,
"away_team_goal" 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,
"goal" TEXT,
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")
);

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



INSERT INTO "Player" VALUES ("1", "101", "Daan Smith");
INSERT INTO "Player" VALUES ("2", "102", "Filipe Ferreira");
INSERT INTO "Player" VALUES ("3", "103", "John Doe");
INSERT INTO "Player" VALUES ("4", "104", "Alex Johnson");
INSERT INTO "Player" VALUES ("5", "105", "Chris Martin");
INSERT INTO "Player" VALUES ("6", "106", "David Lee");
INSERT INTO "Player" VALUES ("7", "107", "Michael Brown");
INSERT INTO "Player" VALUES ("8", "108", "James Wilson");
INSERT INTO "Player" VALUES ("9", "109", "Robert Taylor");
INSERT INTO "Player" VALUES ("10", "110", "William Harris");
INSERT INTO "Player" VALUES ("11", "111", "Richard Clark");
INSERT INTO "Player_Attributes" VALUES ("1", "101");
INSERT INTO "Player_Attributes" VALUES ("2", "102");
INSERT INTO "Player_Attributes" VALUES ("3", "103");
INSERT INTO "Player_Attributes" VALUES ("4", "104");
INSERT INTO "Player_Attributes" VALUES ("5", "105");
INSERT INTO "Player_Attributes" VALUES ("6", "106");
INSERT INTO "Player_Attributes" VALUES ("7", "107");
INSERT INTO "Player_Attributes" VALUES ("8", "108");
INSERT INTO "Player_Attributes" VALUES ("9", "109");
INSERT INTO "Player_Attributes" VALUES ("10", "110");
INSERT INTO "Player_Attributes" VALUES ("11", "111");