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,
"away_player_1" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("away_player_1") REFERENCES "Player"("player_api_id"),
FOREIGN KEY ("home_player_1") REFERENCES "Player"("player_api_id")
);

CREATE TABLE "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
"birthday" TEXT,
PRIMARY KEY ("id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Player A", "1990-05-15");
INSERT INTO "Player" VALUES ("2", "1002", "Player B", "1985-11-20");
INSERT INTO "Player" VALUES ("3", "1003", "Player C", "1992-03-10");
INSERT INTO "Player" VALUES ("4", "1004", "Player D", "1988-07-25");
INSERT INTO "Player" VALUES ("5", "1005", "Player E", "1995-01-01");
INSERT INTO "Player" VALUES ("6", "1006", "Player F", "1980-02-29");
INSERT INTO "Player" VALUES ("7", "1007", "Player G", "1991-09-12");
INSERT INTO "Player" VALUES ("8", "1008", "Player H", "1983-04-05");
INSERT INTO "Player" VALUES ("9", "1009", "Player I", "1987-06-18");
INSERT INTO "Player" VALUES ("10", "1010", "Player J", "1993-12-31");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "75", "1");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "80", "5");
INSERT INTO "Player_Attributes" VALUES ("3", "1003", "70", "1");
INSERT INTO "Player_Attributes" VALUES ("4", "1004", "85", "10");
INSERT INTO "Player_Attributes" VALUES ("5", "1005", "65", "1");
INSERT INTO "Player_Attributes" VALUES ("6", "1006", "90", "1");
INSERT INTO "Player_Attributes" VALUES ("7", "1007", "72", "7");
INSERT INTO "Player_Attributes" VALUES ("8", "1008", "88", "1");
INSERT INTO "Player_Attributes" VALUES ("9", "1009", "78", "3");
INSERT INTO "Player_Attributes" VALUES ("10", "1010", "68", "1");
INSERT INTO "Match" VALUES ("1", "1001", "1002");
INSERT INTO "Match" VALUES ("2", "1003", "1004");
INSERT INTO "Match" VALUES ("3", "1005", "1006");
INSERT INTO "Match" VALUES ("4", "1007", "1008");
INSERT INTO "Match" VALUES ("5", "1009", "1010");
INSERT INTO "Match" VALUES ("6", "1001", "1003");
INSERT INTO "Match" VALUES ("7", "1002", "1005");
INSERT INTO "Match" VALUES ("8", "1004", "1006");
INSERT INTO "Match" VALUES ("9", "1007", "1009");
INSERT INTO "Match" VALUES ("10", "1008", "1010");