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



INSERT INTO "Match" VALUES ("1", "2008-08-17 00:00:00");
INSERT INTO "Match" VALUES ("2", "2008-08-17 00:00:00");
INSERT INTO "Match" VALUES ("3", "2009-08-15 00:00:00");
INSERT INTO "Match" VALUES ("4", "2010-08-14 00:00:00");
INSERT INTO "Match" VALUES ("5", "2011-08-13 00:00:00");
INSERT INTO "Match" VALUES ("6", "2007-08-18 00:00:00");
INSERT INTO "Player" VALUES ("1", "1001", "Lionel Messi");
INSERT INTO "Player" VALUES ("2", "1002", "Cristiano Ronaldo");
INSERT INTO "Player" VALUES ("3", "1003", "Xavi Hernandez");
INSERT INTO "Player" VALUES ("4", "1004", "Andres Iniesta");
INSERT INTO "Player" VALUES ("5", "1005", "Wayne Rooney");
INSERT INTO "Player" VALUES ("6", "1006", "Frank Lampard");
INSERT INTO "Player" VALUES ("7", "1007", "Steven Gerrard");
INSERT INTO "Player" VALUES ("8", "1008", "Didier Drogba");
INSERT INTO "Player" VALUES ("9", "1009", "Zlatan Ibrahimovic");
INSERT INTO "Player" VALUES ("10", "1010", "Kaka");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "2008-09-01 00:00:00", "88", "92", "left");
INSERT INTO "Player_Attributes" VALUES ("2", "1001", "2009-09-01 00:00:00", "90", "93", "left");
INSERT INTO "Player_Attributes" VALUES ("3", "1001", "2010-09-01 00:00:00", "92", "94", "left");
INSERT INTO "Player_Attributes" VALUES ("4", "1001", "2011-09-01 00:00:00", "94", "95", "left");
INSERT INTO "Player_Attributes" VALUES ("5", "1002", "2008-09-01 00:00:00", "87", "91", "right");
INSERT INTO "Player_Attributes" VALUES ("6", "1002", "2009-09-01 00:00:00", "89", "92", "right");
INSERT INTO "Player_Attributes" VALUES ("7", "1002", "2010-09-01 00:00:00", "91", "93", "right");
INSERT INTO "Player_Attributes" VALUES ("8", "1003", "2008-09-01 00:00:00", "85", "87", "right");
INSERT INTO "Player_Attributes" VALUES ("9", "1003", "2009-09-01 00:00:00", "86", "88", "right");
INSERT INTO "Player_Attributes" VALUES ("10", "1003", "2010-09-01 00:00:00", "87", "88", "right");
INSERT INTO "Player_Attributes" VALUES ("11", "1004", "2008-09-01 00:00:00", "84", "86", "right");
INSERT INTO "Player_Attributes" VALUES ("12", "1004", "2009-09-01 00:00:00", "85", "87", "right");
INSERT INTO "Player_Attributes" VALUES ("13", "1004", "2010-09-01 00:00:00", "86", "87", "right");
INSERT INTO "Player_Attributes" VALUES ("14", "1005", "2008-09-01 00:00:00", "79", "82", "right");
INSERT INTO "Player_Attributes" VALUES ("15", "1005", "2009-09-01 00:00:00", "81", "83", "right");
INSERT INTO "Player_Attributes" VALUES ("16", "1005", "2010-09-01 00:00:00", "83", "84", "right");
INSERT INTO "Player_Attributes" VALUES ("17", "1006", "2007-09-01 00:00:00", "82", "84", "right");
INSERT INTO "Player_Attributes" VALUES ("18", "1006", "2011-09-01 00:00:00", "78", "80", "right");
INSERT INTO "Player_Attributes" VALUES ("19", "1007", "2008-09-01 00:00:00", "80", "82", "right");
INSERT INTO "Player_Attributes" VALUES ("20", "1007", "2009-09-01 00:00:00", "81", "83", "right");
INSERT INTO "Player_Attributes" VALUES ("21", "1008", "2008-09-01 00:00:00", "82", "84", "right");
INSERT INTO "Player_Attributes" VALUES ("22", "1009", "2009-09-01 00:00:00", "83", "85", "right");
INSERT INTO "Player_Attributes" VALUES ("23", "1010", "2010-09-01 00:00:00", "80", "82", "right");