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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_api_id" INT,
"date" TEXT,
"overall_rating" INT,
"penalties" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);



INSERT INTO "Player" VALUES ("1", "1001", "Lionel Messi");
INSERT INTO "Player" VALUES ("2", "1002", "Cristiano Ronaldo");
INSERT INTO "Player" VALUES ("3", "1003", "Neymar Jr.");
INSERT INTO "Player" VALUES ("4", "1004", "Kylian Mbappe");
INSERT INTO "Player" VALUES ("5", "1005", "Robert Lewandowski");
INSERT INTO "Player" VALUES ("6", "1006", "Kevin De Bruyne");
INSERT INTO "Player" VALUES ("7", "1007", "Mohamed Salah");
INSERT INTO "Player" VALUES ("8", "1008", "Harry Kane");
INSERT INTO "Player" VALUES ("9", "1009", "Sergio Ramos");
INSERT INTO "Player" VALUES ("10", "1010", "Eden Hazard");
INSERT INTO "Player" VALUES ("11", "1011", "Antoine Griezmann");
INSERT INTO "Player" VALUES ("12", "1012", "Luis Suarez");
INSERT INTO "Player" VALUES ("13", "1013", "Karim Benzema");
INSERT INTO "Player" VALUES ("14", "1014", "Virgil van Dijk");
INSERT INTO "Player" VALUES ("15", "1015", "Manuel Neuer");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2023-01-01", "93", "95");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2023-06-01", "92", "96");
INSERT INTO "Player_Attributes" VALUES ("3", "1002", "2023-01-01", "92", "94");
INSERT INTO "Player_Attributes" VALUES ("4", "1002", "2023-06-01", "91", "95");
INSERT INTO "Player_Attributes" VALUES ("5", "1003", "2023-01-01", "90", "88");
INSERT INTO "Player_Attributes" VALUES ("6", "1003", "2023-06-01", "89", "89");
INSERT INTO "Player_Attributes" VALUES ("7", "1004", "2023-01-01", "91", "85");
INSERT INTO "Player_Attributes" VALUES ("8", "1004", "2023-06-01", "90", "86");
INSERT INTO "Player_Attributes" VALUES ("9", "1005", "2023-01-01", "90", "91");
INSERT INTO "Player_Attributes" VALUES ("10", "1005", "2023-06-01", "89", "92");
INSERT INTO "Player_Attributes" VALUES ("11", "1006", "2023-01-01", "91", "75");
INSERT INTO "Player_Attributes" VALUES ("12", "1006", "2023-06-01", "90", "76");
INSERT INTO "Player_Attributes" VALUES ("13", "1007", "2023-01-01", "89", "80");
INSERT INTO "Player_Attributes" VALUES ("14", "1007", "2023-06-01", "88", "81");
INSERT INTO "Player_Attributes" VALUES ("15", "1008", "2023-01-01", "89", "90");
INSERT INTO "Player_Attributes" VALUES ("16", "1008", "2023-06-01", "88", "91");
INSERT INTO "Player_Attributes" VALUES ("17", "1009", "2023-01-01", "88", "87");
INSERT INTO "Player_Attributes" VALUES ("18", "1009", "2023-06-01", "87", "88");
INSERT INTO "Player_Attributes" VALUES ("19", "1010", "2023-01-01", "87", "82");
INSERT INTO "Player_Attributes" VALUES ("20", "1010", "2023-06-01", "86", "83");
INSERT INTO "Player_Attributes" VALUES ("21", "1011", "2023-01-01", "87", "84");
INSERT INTO "Player_Attributes" VALUES ("22", "1011", "2023-06-01", "86", "85");
INSERT INTO "Player_Attributes" VALUES ("23", "1012", "2023-01-01", "86", "89");
INSERT INTO "Player_Attributes" VALUES ("24", "1012", "2023-06-01", "85", "90");
INSERT INTO "Player_Attributes" VALUES ("25", "1013", "2023-01-01", "88", "80");
INSERT INTO "Player_Attributes" VALUES ("26", "1013", "2023-06-01", "87", "81");
INSERT INTO "Player_Attributes" VALUES ("27", "1014", "2023-01-01", "90", "60");
INSERT INTO "Player_Attributes" VALUES ("28", "1014", "2023-06-01", "89", "61");
INSERT INTO "Player_Attributes" VALUES ("29", "1015", "2023-01-01", "89", "50");
INSERT INTO "Player_Attributes" VALUES ("30", "1015", "2023-06-01", "88", "51");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1003");
INSERT INTO "Match" VALUES ("4", "1004");
INSERT INTO "Match" VALUES ("5", "1005");
INSERT INTO "Match" VALUES ("6", "1006");
INSERT INTO "Match" VALUES ("7", "1007");
INSERT INTO "Match" VALUES ("8", "1008");
INSERT INTO "Match" VALUES ("9", "1009");
INSERT INTO "Match" VALUES ("10", "1010");