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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_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", "Pietro Marino", "1990-05-15");
INSERT INTO "Player" VALUES ("2", "1002", "Luca Bianchi", "1988-11-23");
INSERT INTO "Player" VALUES ("3", "1003", "Marco Rossi", "1992-07-30");
INSERT INTO "Player" VALUES ("4", "1004", "Giovanni Esposito", "1991-01-10");
INSERT INTO "Player" VALUES ("5", "1005", "Pietro Marino", "1995-03-22");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "1001", "2015-06-01", "75", "80");
INSERT INTO "Player_Attributes" VALUES ("2", "5002", "1001", "2016-06-01", "78", "82");
INSERT INTO "Player_Attributes" VALUES ("3", "5003", "1001", "2017-06-01", "77", "83");
INSERT INTO "Player_Attributes" VALUES ("4", "5004", "1002", "2015-06-01", "70", "75");
INSERT INTO "Player_Attributes" VALUES ("5", "5005", "1003", "2015-06-01", "80", "85");
INSERT INTO "Player_Attributes" VALUES ("6", "5006", "1004", "2015-06-01", "65", "70");
INSERT INTO "Player_Attributes" VALUES ("7", "5007", "1005", "2016-06-01", "60", "65");
INSERT INTO "Player_Attributes" VALUES ("8", "5008", "1005", "2017-06-01", "62", "67");
INSERT INTO "Player_Attributes" VALUES ("9", "5009", "1005", "2018-06-01", "63", "68");