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

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



INSERT INTO "Match" VALUES ("1", "2013-02-22 00:00:00");
INSERT INTO "Match" VALUES ("2", "2013-03-01 00:00:00");
INSERT INTO "Match" VALUES ("3", "2014-01-15 00:00:00");
INSERT INTO "Match" VALUES ("4", "2013-02-22 00:00:00");
INSERT INTO "Match" VALUES ("5", "2015-05-10 00:00:00");
INSERT INTO "Player" VALUES ("1", "1001", "Kevin Berigaud");
INSERT INTO "Player" VALUES ("2", "1002", "Lionel Messi");
INSERT INTO "Player" VALUES ("3", "1003", "Cristiano Ronaldo");
INSERT INTO "Player" VALUES ("4", "1004", "Kevin De Bruyne");
INSERT INTO "Player" VALUES ("5", "1005", "Neymar Jr.");
INSERT INTO "Player" VALUES ("6", "1006", "Kevin Berigaud");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2013-02-22 00:00:00", "75", "High", "Medium");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2013-03-01 00:00:00", "76", "High", "High");
INSERT INTO "Player_Attributes" VALUES ("3", "1002", "2013-02-22 00:00:00", "92", "High", "Low");
INSERT INTO "Player_Attributes" VALUES ("4", "1003", "2014-01-15 00:00:00", "90", "High", "Medium");
INSERT INTO "Player_Attributes" VALUES ("5", "1001", "2014-02-22 00:00:00", "77", "High", "Medium");
INSERT INTO "Player_Attributes" VALUES ("6", "1004", "2013-02-22 00:00:00", "88", "High", "High");
INSERT INTO "Player_Attributes" VALUES ("7", "1006", "2013-02-22 00:00:00", "74", "Medium", "Low");