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

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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_id" INT,
"player_api_id" INT,
"overall_rating" INT,
"jumping" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("player_fifa_api_id") REFERENCES "Player"("player_fifa_api_id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Player A", "2001");
INSERT INTO "Player" VALUES ("2", "1002", "Player B", "2002");
INSERT INTO "Player" VALUES ("3", "1003", "Player C", "2003");
INSERT INTO "Player" VALUES ("4", "1004", "Player D", "2004");
INSERT INTO "Player" VALUES ("5", "1005", "Player E", "2005");
INSERT INTO "Player" VALUES ("6", "1006", "Player F", "2006");
INSERT INTO "Player" VALUES ("7", "1007", "Player G", "2007");
INSERT INTO "Player" VALUES ("23", "1023", "Player X", "2023");
INSERT INTO "Player" VALUES ("24", "1024", "Player Y", "2024");
INSERT INTO "Player" VALUES ("25", "1025", "Player Z", "2025");
INSERT INTO "Player_Attributes" VALUES ("1", "2001", "1001", "85", "70");
INSERT INTO "Player_Attributes" VALUES ("2", "2002", "1002", "78", "65");
INSERT INTO "Player_Attributes" VALUES ("3", "2003", "1003", "90", "80");
INSERT INTO "Player_Attributes" VALUES ("4", "2004", "1004", "75", "60");
INSERT INTO "Player_Attributes" VALUES ("5", "2005", "1005", "82", "72");
INSERT INTO "Player_Attributes" VALUES ("6", "2006", "1006", "88", "75");
INSERT INTO "Player_Attributes" VALUES ("7", "2007", "1007", "70", "55");
INSERT INTO "Player_Attributes" VALUES ("8", "2006", "1006", "89", "78");
INSERT INTO "Player_Attributes" VALUES ("9", "2023", "1023", "92", "85");
INSERT INTO "Player_Attributes" VALUES ("10", "2024", "1024", "79", "68");
INSERT INTO "Player_Attributes" VALUES ("11", "2025", "1025", "81", "71");
INSERT INTO "Player_Attributes" VALUES ("12", "2023", "1023", "93", "80");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1006");
INSERT INTO "Match" VALUES ("4", "1023");
INSERT INTO "Match" VALUES ("5", "1004");
INSERT INTO "Team" VALUES ("1", "Team Alpha");
INSERT INTO "Team" VALUES ("2", "Team Beta");
INSERT INTO "Team" VALUES ("3", "Team Gamma");