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 "Player" (
"id" INT,
"player_api_id" INT UNIQUE,
"player_name" TEXT,
"player_fifa_api_id" INT UNIQUE,
"birthday" TEXT,
PRIMARY KEY ("id")
);

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



INSERT INTO "Player" VALUES ("1", "1001", "Aaron Doran", "5001", "1991-05-07");
INSERT INTO "Player" VALUES ("2", "1002", "John Smith", "5002", "1988-11-23");
INSERT INTO "Player" VALUES ("3", "1003", "Michael Johnson", "5003", "1995-02-14");
INSERT INTO "Player" VALUES ("4", "1004", "David Brown", "5004", "1990-07-30");
INSERT INTO "Player" VALUES ("5", "1005", "Chris Evans", "5005", "1992-12-01");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2023-01-01", "75", "82");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2023-06-01", "77", "83");
INSERT INTO "Player_Attributes" VALUES ("3", "1002", "2023-01-01", "70", "75");
INSERT INTO "Player_Attributes" VALUES ("4", "1003", "2023-01-01", "80", "88");
INSERT INTO "Player_Attributes" VALUES ("5", "1004", "2023-01-01", "65", "70");
INSERT INTO "Player_Attributes" VALUES ("6", "1005", "2023-01-01", "60", "65");
INSERT INTO "Player_Attributes" VALUES ("7", "1001", "2022-06-01", "74", "81");