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_fifa_api_id" INT,
"player_api_id" INT,
"date" TEXT,
"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", "100001", "Player A", "200001", "1987-05-10");
INSERT INTO "Player" VALUES ("2", "100002", "Player B", "200002", "1988-11-20");
INSERT INTO "Player" VALUES ("3", "100003", "Player C", "200003", "1990-01-15");
INSERT INTO "Player" VALUES ("4", "100004", "Player D", "200004", "1991-07-01");
INSERT INTO "Player" VALUES ("5", "100005", "Player E", "200005", "1992-03-25");
INSERT INTO "Player" VALUES ("6", "100006", "Player F", "200006", "1986-09-12");
INSERT INTO "Player" VALUES ("7", "100007", "Player G", "200007", "1993-02-28");
INSERT INTO "Player" VALUES ("8", "100008", "Player H", "200008", "1989-04-04");
INSERT INTO "Player" VALUES ("9", "100009", "Player I", "200009", "1990-12-30");
INSERT INTO "Player" VALUES ("10", "100010", "Player J", "200010", "1991-06-18");
INSERT INTO "Player_Attributes" VALUES ("1", "200001", "100001", "2015-01-01", "85", "left");
INSERT INTO "Player_Attributes" VALUES ("2", "200002", "100002", "2015-01-01", "88", "right");
INSERT INTO "Player_Attributes" VALUES ("3", "200003", "100003", "2015-01-01", "82", "left");
INSERT INTO "Player_Attributes" VALUES ("4", "200004", "100004", "2015-01-01", "79", "right");
INSERT INTO "Player_Attributes" VALUES ("5", "200005", "100005", "2015-01-01", "80", "left");
INSERT INTO "Player_Attributes" VALUES ("6", "200006", "100006", "2015-01-01", "83", "left");
INSERT INTO "Player_Attributes" VALUES ("7", "200007", "100007", "2015-01-01", "75", "right");
INSERT INTO "Player_Attributes" VALUES ("8", "200008", "100008", "2015-01-01", "86", "left");
INSERT INTO "Player_Attributes" VALUES ("9", "200009", "100009", "2015-01-01", "81", "right");
INSERT INTO "Player_Attributes" VALUES ("10", "200010", "100010", "2015-01-01", "78", "left");
INSERT INTO "Player_Attributes" VALUES ("11", "200001", "100001", "2016-01-01", "86", "left");
INSERT INTO "Player_Attributes" VALUES ("12", "200003", "100003", "2016-01-01", "83", "left");
INSERT INTO "Player_Attributes" VALUES ("13", "200005", "100005", "2016-01-01", "81", "left");
INSERT INTO "Player_Attributes" VALUES ("14", "200008", "100008", "2016-01-01", "87", "left");
INSERT INTO "Player_Attributes" VALUES ("15", "200010", "100010", "2016-01-01", "79", "left");