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



INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1003");
INSERT INTO "Player" VALUES ("1", "5001", "Marko Arnautovic", "1989-04-19");
INSERT INTO "Player" VALUES ("2", "5002", "Lionel Messi", "1987-06-24");
INSERT INTO "Player" VALUES ("3", "5003", "Cristiano Ronaldo", "1985-02-05");
INSERT INTO "Player" VALUES ("4", "5004", "Neymar Jr", "1992-02-05");
INSERT INTO "Player_Attributes" VALUES ("1", "5001", "2007-02-22 00:00:00", "60", "75");
INSERT INTO "Player_Attributes" VALUES ("2", "5001", "2008-05-15 00:00:00", "65", "78");
INSERT INTO "Player_Attributes" VALUES ("3", "5001", "2010-11-20 00:00:00", "70", "80");
INSERT INTO "Player_Attributes" VALUES ("4", "5001", "2013-07-10 00:00:00", "75", "82");
INSERT INTO "Player_Attributes" VALUES ("5", "5001", "2015-03-05 00:00:00", "80", "85");
INSERT INTO "Player_Attributes" VALUES ("6", "5001", "2016-04-21 00:00:00", "82", "86");
INSERT INTO "Player_Attributes" VALUES ("7", "5001", "2016-04-22 00:00:00", "83", "87");
INSERT INTO "Player_Attributes" VALUES ("8", "5001", "2007-02-21 00:00:00", "59", "74");
INSERT INTO "Player_Attributes" VALUES ("9", "5002", "2010-01-01 00:00:00", "90", "95");
INSERT INTO "Player_Attributes" VALUES ("10", "5003", "2012-06-15 00:00:00", "88", "92");
INSERT INTO "Player_Attributes" VALUES ("11", "5004", "2014-09-10 00:00:00", "85", "90");