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



INSERT INTO "Match" VALUES ("1", "2013-01-01");
INSERT INTO "Match" VALUES ("2", "2014-05-15");
INSERT INTO "Match" VALUES ("3", "2015-11-20");
INSERT INTO "Match" VALUES ("4", "2016-03-10");
INSERT INTO "Match" VALUES ("5", "2012-09-01");
INSERT INTO "Player" VALUES ("1", "1001", "Lionel Messi", "1987-06-24");
INSERT INTO "Player" VALUES ("2", "1002", "Cristiano Ronaldo", "1985-02-05");
INSERT INTO "Player" VALUES ("3", "1003", "Kylian Mbappe", "1998-12-20");
INSERT INTO "Player" VALUES ("4", "1004", "Usain Bolt", "1986-08-21");
INSERT INTO "Player" VALUES ("5", "1005", "Neymar Jr.", "1992-02-05");
INSERT INTO "Player" VALUES ("6", "1006", "Gareth Bale", "1989-07-16");
INSERT INTO "Player" VALUES ("7", "1007", "Mohamed Salah", "1992-06-15");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2013-03-01", "95", "90");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2014-07-01", "96", "91");
INSERT INTO "Player_Attributes" VALUES ("3", "1002", "2013-04-01", "94", "92");
INSERT INTO "Player_Attributes" VALUES ("4", "1002", "2015-01-01", "93", "97");
INSERT INTO "Player_Attributes" VALUES ("5", "1003", "2015-06-01", "88", "98");
INSERT INTO "Player_Attributes" VALUES ("6", "1003", "2016-02-01", "90", "99");
INSERT INTO "Player_Attributes" VALUES ("7", "1004", "2014-02-01", "70", "99");
INSERT INTO "Player_Attributes" VALUES ("8", "1005", "2013-09-01", "90", "95");
INSERT INTO "Player_Attributes" VALUES ("9", "1005", "2015-05-01", "91", "97");
INSERT INTO "Player_Attributes" VALUES ("10", "1006", "2014-01-01", "89", "97");
INSERT INTO "Player_Attributes" VALUES ("11", "1006", "2016-01-01", "88", "96");
INSERT INTO "Player_Attributes" VALUES ("12", "1007", "2013-10-01", "85", "96");
INSERT INTO "Player_Attributes" VALUES ("13", "1007", "2015-08-01", "87", "98");