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,
"overall_rating" INT,
"attacking_work_rate" TEXT,
"defensive_work_rate" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);



INSERT INTO "Player" VALUES ("1", "1001", "David Wilson");
INSERT INTO "Player" VALUES ("2", "1002", "John Doe");
INSERT INTO "Player" VALUES ("3", "1003", "Jane Smith");
INSERT INTO "Player" VALUES ("4", "1004", "Peter Jones");
INSERT INTO "Player" VALUES ("5", "1005", "David Beckham");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "85", "High", "Medium");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "78", "Medium", "High");
INSERT INTO "Player_Attributes" VALUES ("3", "1003", "90", "High", "Low");
INSERT INTO "Player_Attributes" VALUES ("4", "1004", "70", "Low", "Medium");
INSERT INTO "Player_Attributes" VALUES ("5", "1005", "92", "High", "High");
INSERT INTO "Player_Attributes" VALUES ("6", "1001", "86", "High", "High");
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");