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,
"potential" INT,
"finishing" INT,
"balance" 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 "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", "Kevin De Bruyne");
INSERT INTO "Player" VALUES ("5", "1005", "Robert Lewandowski");
INSERT INTO "Player" VALUES ("6", "1006", "Kylian Mbappe");
INSERT INTO "Player" VALUES ("7", "1007", "Luka Modric");
INSERT INTO "Player" VALUES ("8", "1008", "Sergio Ramos");
INSERT INTO "Player" VALUES ("9", "1009", "Mohamed Salah");
INSERT INTO "Player" VALUES ("10", "1010", "Eden Hazard");
INSERT INTO "Player" VALUES ("11", "1011", "Player A");
INSERT INTO "Player" VALUES ("12", "1012", "Player B");
INSERT INTO "Player" VALUES ("13", "1013", "Player C");
INSERT INTO "Player" VALUES ("14", "1014", "Player D");
INSERT INTO "Player" VALUES ("15", "1015", "Player E");
INSERT INTO "Player" VALUES ("16", "1016", "Player F");
INSERT INTO "Player" VALUES ("17", "1017", "Player G");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2015-09-21 00:00:00", "93", "95", "95", "95");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "2015-09-21 00:00:00", "92", "92", "94", "90");
INSERT INTO "Player_Attributes" VALUES ("3", "1003", "2015-09-21 00:00:00", "90", "94", "88", "85");
INSERT INTO "Player_Attributes" VALUES ("4", "1004", "2015-09-21 00:00:00", "89", "91", "87", "80");
INSERT INTO "Player_Attributes" VALUES ("5", "1005", "2015-09-21 00:00:00", "88", "88", "90", "75");
INSERT INTO "Player_Attributes" VALUES ("6", "1006", "2015-09-21 00:00:00", "87", "92", "85", "82");
INSERT INTO "Player_Attributes" VALUES ("7", "1007", "2015-09-21 00:00:00", "86", "86", "78", "70");
INSERT INTO "Player_Attributes" VALUES ("8", "1008", "2015-09-21 00:00:00", "85", "85", "70", "65");
INSERT INTO "Player_Attributes" VALUES ("9", "1009", "2015-09-21 00:00:00", "89", "90", "89", "88");
INSERT INTO "Player_Attributes" VALUES ("10", "1010", "2015-09-21 00:00:00", "88", "89", "86", "87");
INSERT INTO "Player_Attributes" VALUES ("11", "1011", "2015-09-21 00:00:00", "60", "61", "55", "70");
INSERT INTO "Player_Attributes" VALUES ("12", "1012", "2015-09-21 00:00:00", "59", "61", "50", "70");
INSERT INTO "Player_Attributes" VALUES ("13", "1013", "2015-09-21 00:00:00", "58", "61", "45", "65");
INSERT INTO "Player_Attributes" VALUES ("14", "1014", "2015-09-21 00:00:00", "62", "60", "60", "75");
INSERT INTO "Player_Attributes" VALUES ("15", "1015", "2015-09-21 00:00:00", "55", "62", "40", "60");
INSERT INTO "Player_Attributes" VALUES ("16", "1016", "2015-09-21 00:00:00", "61", "61", "58", "72");
INSERT INTO "Player_Attributes" VALUES ("17", "1017", "2015-09-21 00:00:00", "57", "61", "52", "68");
INSERT INTO "Player_Attributes" VALUES ("18", "1011", "2016-01-01 00:00:00", "62", "61", "58", "71");
INSERT INTO "Player_Attributes" VALUES ("19", "1011", "2017-01-01 00:00:00", "63", "61", "60", "73");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1003");
INSERT INTO "Match" VALUES ("4", "1011");
INSERT INTO "Match" VALUES ("5", "1016");
INSERT INTO "Team_Attributes" VALUES ("1", "50");
INSERT INTO "Team_Attributes" VALUES ("2", "60");