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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_id" INT,
"player_api_id" INT,
"overall_rating" INT,
"preferred_foot" TEXT,
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", "5001", "1987-05-12", "180");
INSERT INTO "Player" VALUES ("2", "1002", "5002", "1988-11-23", "175");
INSERT INTO "Player" VALUES ("3", "1003", "5003", "1990-07-30", "182");
INSERT INTO "Player" VALUES ("4", "1004", "5004", "1991-01-15", "178");
INSERT INTO "Player" VALUES ("5", "1005", "5005", "1992-12-05", "185");
INSERT INTO "Player" VALUES ("6", "1006", "5006", "1986-03-20", "177");
INSERT INTO "Player" VALUES ("7", "1007", "5007", "1993-08-10", "180");
INSERT INTO "Player" VALUES ("8", "1008", "5008", "1989-09-25", "174");
INSERT INTO "Player" VALUES ("9", "1009", "5009", "1992-04-18", "181");
INSERT INTO "Player" VALUES ("10", "1010", "5010", "1987-02-28", "179");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "1001", "85", "left");
INSERT INTO "Player_Attributes" VALUES ("2", "5002", "1002", "78", "right");
INSERT INTO "Player_Attributes" VALUES ("3", "5003", "1003", "90", "left");
INSERT INTO "Player_Attributes" VALUES ("4", "5004", "1004", "82", "right");
INSERT INTO "Player_Attributes" VALUES ("5", "5005", "1005", "88", "left");
INSERT INTO "Player_Attributes" VALUES ("6", "5006", "1006", "75", "right");
INSERT INTO "Player_Attributes" VALUES ("7", "5007", "1007", "80", "left");
INSERT INTO "Player_Attributes" VALUES ("8", "5008", "1008", "77", "right");
INSERT INTO "Player_Attributes" VALUES ("9", "5009", "1009", "83", "left");
INSERT INTO "Player_Attributes" VALUES ("10", "5010", "1010", "79", "right");
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");