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,
"heading_accuracy" 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")
);



INSERT INTO "Player" VALUES ("1", "10001", "Ariel Borysiuk", "20001");
INSERT INTO "Player" VALUES ("2", "10002", "Lionel Messi", "20002");
INSERT INTO "Player" VALUES ("3", "10003", "Cristiano Ronaldo", "20003");
INSERT INTO "Player" VALUES ("4", "10004", "Neymar Jr.", "20004");
INSERT INTO "Player" VALUES ("5", "10005", "Robert Lewandowski", "20005");
INSERT INTO "Player" VALUES ("6", "10006", "Kevin De Bruyne", "20006");
INSERT INTO "Player" VALUES ("7", "10007", "Sergio Ramos", "20007");
INSERT INTO "Player" VALUES ("8", "10008", "Virgil van Dijk", "20008");
INSERT INTO "Player" VALUES ("9", "10009", "Mohamed Salah", "20009");
INSERT INTO "Player" VALUES ("10", "10010", "Kylian Mbappé", "20010");
INSERT INTO "Player_Attributes" VALUES ("1", "20001", "10001", "75", "80", "70");
INSERT INTO "Player_Attributes" VALUES ("2", "20002", "10002", "94", "60", "75");
INSERT INTO "Player_Attributes" VALUES ("3", "20003", "10003", "93", "88", "90");
INSERT INTO "Player_Attributes" VALUES ("4", "20004", "10004", "92", "55", "80");
INSERT INTO "Player_Attributes" VALUES ("5", "20005", "10005", "91", "85", "82");
INSERT INTO "Player_Attributes" VALUES ("6", "20006", "10006", "91", "65", "70");
INSERT INTO "Player_Attributes" VALUES ("7", "20007", "10007", "89", "92", "88");
INSERT INTO "Player_Attributes" VALUES ("8", "20008", "10008", "90", "90", "85");
INSERT INTO "Player_Attributes" VALUES ("9", "20009", "10009", "90", "68", "78");
INSERT INTO "Player_Attributes" VALUES ("10", "20010", "10010", "91", "62", "95");
INSERT INTO "Player_Attributes" VALUES ("11", "20001", "10001", "76", "82", "71");
INSERT INTO "Player_Attributes" VALUES ("12", "20001", "10001", "77", "85", "72");
INSERT INTO "Match" VALUES ("1", "10001");
INSERT INTO "Match" VALUES ("2", "10002");
INSERT INTO "Match" VALUES ("3", "10003");
INSERT INTO "Match" VALUES ("4", "10004");
INSERT INTO "Match" VALUES ("5", "10005");
INSERT INTO "Match" VALUES ("6", "10006");
INSERT INTO "Match" VALUES ("7", "10007");
INSERT INTO "Match" VALUES ("8", "10008");
INSERT INTO "Match" VALUES ("9", "10009");
INSERT INTO "Match" VALUES ("10", "10010");