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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_id" INT,
"player_api_id" INT,
"overall_rating" INT,
"potential" INT,
"heading_accuracy" 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")
);



INSERT INTO "Player" VALUES ("1", "1001", "Lionel Messi", "2001", "170");
INSERT INTO "Player" VALUES ("2", "1002", "Cristiano Ronaldo", "2002", "187");
INSERT INTO "Player" VALUES ("3", "1003", "Sergio Ramos", "2003", "184");
INSERT INTO "Player" VALUES ("4", "1004", "Virgil van Dijk", "2004", "193");
INSERT INTO "Player" VALUES ("5", "1005", "Robert Lewandowski", "2005", "185");
INSERT INTO "Player" VALUES ("6", "1006", "Harry Kane", "2006", "188");
INSERT INTO "Player" VALUES ("7", "1007", "Zlatan Ibrahimovic", "2007", "195");
INSERT INTO "Player" VALUES ("8", "1008", "Gerard Pique", "2008", "192");
INSERT INTO "Player" VALUES ("9", "1009", "Olivier Giroud", "2009", "193");
INSERT INTO "Player" VALUES ("10", "1010", "Romelu Lukaku", "2010", "191");
INSERT INTO "Player" VALUES ("11", "1011", "Neymar Jr.", "2011", "175");
INSERT INTO "Player" VALUES ("12", "1012", "Kevin De Bruyne", "2012", "181");
INSERT INTO "Player" VALUES ("13", "1013", "Eden Hazard", "2013", "173");
INSERT INTO "Player" VALUES ("14", "1014", "Antoine Griezmann", "2014", "176");
INSERT INTO "Player" VALUES ("15", "1015", "Paul Pogba", "2015", "191");
INSERT INTO "Player" VALUES ("16", "1016", "Thiago Silva", "2016", "183");
INSERT INTO "Player" VALUES ("17", "1017", "Manuel Neuer", "2017", "193");
INSERT INTO "Player" VALUES ("18", "1018", "Alvaro Morata", "2018", "189");
INSERT INTO "Player" VALUES ("19", "1019", "Diego Godin", "2019", "186");
INSERT INTO "Player" VALUES ("20", "1020", "Jamie Vardy", "2020", "178");
INSERT INTO "Player_Attributes" VALUES ("1", "2001", "1001", "94", "94", "70");
INSERT INTO "Player_Attributes" VALUES ("2", "2002", "1002", "93", "93", "88");
INSERT INTO "Player_Attributes" VALUES ("3", "2003", "1003", "89", "89", "91");
INSERT INTO "Player_Attributes" VALUES ("4", "2004", "1004", "90", "91", "92");
INSERT INTO "Player_Attributes" VALUES ("5", "2005", "1005", "91", "91", "85");
INSERT INTO "Player_Attributes" VALUES ("6", "2006", "1006", "89", "90", "87");
INSERT INTO "Player_Attributes" VALUES ("7", "2007", "1007", "85", "85", "89");
INSERT INTO "Player_Attributes" VALUES ("8", "2008", "1008", "88", "88", "90");
INSERT INTO "Player_Attributes" VALUES ("9", "2009", "1009", "82", "82", "93");
INSERT INTO "Player_Attributes" VALUES ("10", "2010", "1010", "85", "86", "84");
INSERT INTO "Player_Attributes" VALUES ("11", "2011", "1011", "92", "92", "65");
INSERT INTO "Player_Attributes" VALUES ("12", "2012", "1012", "91", "91", "75");
INSERT INTO "Player_Attributes" VALUES ("13", "2013", "1013", "90", "90", "60");
INSERT INTO "Player_Attributes" VALUES ("14", "2014", "1014", "88", "88", "72");
INSERT INTO "Player_Attributes" VALUES ("15", "2015", "1015", "87", "88", "80");
INSERT INTO "Player_Attributes" VALUES ("16", "2016", "1016", "87", "87", "88");
INSERT INTO "Player_Attributes" VALUES ("17", "2017", "1017", "90", "90", "50");
INSERT INTO "Player_Attributes" VALUES ("18", "2018", "1018", "83", "84", "82");
INSERT INTO "Player_Attributes" VALUES ("19", "2019", "1019", "85", "85", "90");
INSERT INTO "Player_Attributes" VALUES ("20", "2020", "1020", "85", "85", "78");
INSERT INTO "Player_Attributes" VALUES ("21", "2002", "1002", "92", "92", "89");
INSERT INTO "Player_Attributes" VALUES ("22", "2003", "1003", "88", "88", "90");
INSERT INTO "Player_Attributes" VALUES ("23", "2004", "1004", "91", "92", "93");
INSERT INTO "Player_Attributes" VALUES ("24", "2005", "1005", "90", "90", "86");
INSERT INTO "Player_Attributes" VALUES ("25", "2006", "1006", "88", "89", "86");
INSERT INTO "Player_Attributes" VALUES ("26", "2009", "1009", "81", "81", "94");
INSERT INTO "Player_Attributes" VALUES ("27", "2010", "1010", "84", "85", "85");
INSERT INTO "Player_Attributes" VALUES ("28", "2015", "1015", "86", "87", "81");
INSERT INTO "Player_Attributes" VALUES ("29", "2018", "1018", "82", "83", "83");
INSERT INTO "Player_Attributes" VALUES ("30", "2002", "1002", "91", "91", "87");
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");
INSERT INTO "Match" VALUES ("11", "1011");
INSERT INTO "Match" VALUES ("12", "1012");
INSERT INTO "Match" VALUES ("13", "1013");
INSERT INTO "Match" VALUES ("14", "1014");
INSERT INTO "Match" VALUES ("15", "1015");
INSERT INTO "Match" VALUES ("16", "1016");
INSERT INTO "Match" VALUES ("17", "1017");
INSERT INTO "Match" VALUES ("18", "1018");
INSERT INTO "Match" VALUES ("19", "1019");
INSERT INTO "Match" VALUES ("20", "1020");