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,
"long_shots" 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", "Ahmed Samir Farag", "2001");
INSERT INTO "Player" VALUES ("2", "1002", "Mohamed Salah", "2002");
INSERT INTO "Player" VALUES ("3", "1003", "Ahmed Hassan", "2003");
INSERT INTO "Player" VALUES ("4", "1004", "Zinedine Zidane", "2004");
INSERT INTO "Player" VALUES ("5", "1005", "Lionel Messi", "2005");
INSERT INTO "Player" VALUES ("6", "1006", "Cristiano Ronaldo", "2006");
INSERT INTO "Player" VALUES ("7", "1007", "Ahmed Samir Farag", "2007");
INSERT INTO "Player" VALUES ("8", "1008", "Ahmed Samir Farag", "2008");
INSERT INTO "Player_Attributes" VALUES ("1", "2001", "1001", "75", "60");
INSERT INTO "Player_Attributes" VALUES ("2", "2001", "1001", "76", "65");
INSERT INTO "Player_Attributes" VALUES ("3", "2001", "1001", "74", "55");
INSERT INTO "Player_Attributes" VALUES ("4", "2002", "1002", "88", "80");
INSERT INTO "Player_Attributes" VALUES ("5", "2003", "1003", "70", "50");
INSERT INTO "Player_Attributes" VALUES ("6", "2004", "1004", "90", "90");
INSERT INTO "Player_Attributes" VALUES ("7", "2005", "1005", "95", "85");
INSERT INTO "Player_Attributes" VALUES ("8", "2006", "1006", "94", "88");
INSERT INTO "Player_Attributes" VALUES ("9", "2007", "1007", "73", "0");
INSERT INTO "Player_Attributes" VALUES ("10", "2008", "1008", "77", "70");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1001");
INSERT INTO "Match" VALUES ("4", "1003");
INSERT INTO "Match" VALUES ("5", "1001");
INSERT INTO "Match" VALUES ("6", "1007");
INSERT INTO "Team" VALUES ("1", "Al Ahly");
INSERT INTO "Team" VALUES ("2", "Zamalek");
INSERT INTO "Team" VALUES ("3", "Pyramids FC");