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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_fifa_api_id" INT,
"player_api_id" INT,
"overall_rating" INT,
"potential" INT,
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 "Match" VALUES ("1", "2015-08-08 00:00:00");
INSERT INTO "Match" VALUES ("2", "2015-08-09 00:00:00");
INSERT INTO "Match" VALUES ("3", "2015-08-10 00:00:00");
INSERT INTO "Match" VALUES ("4", "2015-08-11 00:00:00");
INSERT INTO "Match" VALUES ("5", "2015-08-12 00:00:00");
INSERT INTO "Player" VALUES ("1", "1001", "Aaron Doran", "2001");
INSERT INTO "Player" VALUES ("2", "1002", "John Doe", "2002");
INSERT INTO "Player" VALUES ("3", "1003", "Jane Smith", "2003");
INSERT INTO "Player" VALUES ("4", "1004", "Aaron Ramsey", "2004");
INSERT INTO "Player" VALUES ("5", "1005", "David Beckham", "2005");
INSERT INTO "Player_Attributes" VALUES ("1", "2001", "1001", "75", "85");
INSERT INTO "Player_Attributes" VALUES ("2", "2002", "1002", "80", "88");
INSERT INTO "Player_Attributes" VALUES ("3", "2003", "1003", "70", "78");
INSERT INTO "Player_Attributes" VALUES ("4", "2004", "1004", "82", "89");
INSERT INTO "Player_Attributes" VALUES ("5", "2001", "1001", "76", "86");
INSERT INTO "Player_Attributes" VALUES ("6", "2005", "1005", "90", "92");