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"),
FOREIGN KEY ("home_team_api_id") REFERENCES "Team"("team_api_id")
);

CREATE TABLE "Team" (
"id" INT,
"team_api_id" INT UNIQUE,
"team_long_name" TEXT,
"team_short_name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Team_Attributes" (
"id" INT,
"team_api_id" INT,
"date" TEXT,
"buildUpPlaySpeed" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("team_api_id") REFERENCES "Team"("team_api_id")
);



INSERT INTO "Team" VALUES ("1", "1001", "Real Madrid", "RMA");
INSERT INTO "Team" VALUES ("2", "1002", "FC Barcelona", "BAR");
INSERT INTO "Team" VALUES ("3", "1003", "Manchester United", "MUN");
INSERT INTO "Team" VALUES ("4", "1004", "Bayern Munich", "BAY");
INSERT INTO "Team" VALUES ("5", "1005", "Liverpool FC", "LIV");
INSERT INTO "Team" VALUES ("6", "1006", "Paris Saint-Germain", "PSG");
INSERT INTO "Team" VALUES ("7", "1007", "Juventus", "JUV");
INSERT INTO "Team" VALUES ("8", "1008", "Borussia Dortmund", "DOR");
INSERT INTO "Team" VALUES ("9", "1009", "Chelsea FC", "CHE");
INSERT INTO "Team" VALUES ("10", "1010", "Atletico Madrid", "ATM");
INSERT INTO "Match" VALUES ("1", "1001");
INSERT INTO "Match" VALUES ("2", "1002");
INSERT INTO "Match" VALUES ("3", "1003");
INSERT INTO "Match" VALUES ("4", "1004");
INSERT INTO "Match" VALUES ("5", "1005");
INSERT INTO "Match" VALUES ("6", "1006");
INSERT INTO "Match" VALUES ("7", "1007");
INSERT INTO "Match" VALUES ("8", "1008");
INSERT INTO "Match" VALUES ("9", "1009");
INSERT INTO "Match" VALUES ("10", "1010");
INSERT INTO "Team_Attributes" VALUES ("1", "1001", "2015-09-20", "70");
INSERT INTO "Team_Attributes" VALUES ("2", "1002", "2015-09-20", "75");
INSERT INTO "Team_Attributes" VALUES ("3", "1003", "2015-09-20", "65");
INSERT INTO "Team_Attributes" VALUES ("4", "1004", "2015-09-20", "80");
INSERT INTO "Team_Attributes" VALUES ("5", "1005", "2015-09-20", "60");
INSERT INTO "Team_Attributes" VALUES ("6", "1006", "2015-09-20", "72");
INSERT INTO "Team_Attributes" VALUES ("7", "1007", "2015-09-20", "68");
INSERT INTO "Team_Attributes" VALUES ("8", "1008", "2015-09-20", "78");
INSERT INTO "Team_Attributes" VALUES ("9", "1009", "2015-09-20", "63");
INSERT INTO "Team_Attributes" VALUES ("10", "1010", "2015-09-20", "67");
INSERT INTO "Team_Attributes" VALUES ("11", "1001", "2016-01-01", "72");
INSERT INTO "Team_Attributes" VALUES ("12", "1002", "2016-01-01", "77");
INSERT INTO "Team_Attributes" VALUES ("13", "1003", "2016-01-01", "66");
INSERT INTO "Team_Attributes" VALUES ("14", "1004", "2016-01-01", "82");
INSERT INTO "Team_Attributes" VALUES ("15", "1005", "2016-01-01", "61");
INSERT INTO "Team_Attributes" VALUES ("16", "1006", "2016-01-01", "74");
INSERT INTO "Team_Attributes" VALUES ("17", "1007", "2016-01-01", "69");
INSERT INTO "Team_Attributes" VALUES ("18", "1008", "2016-01-01", "79");
INSERT INTO "Team_Attributes" VALUES ("19", "1009", "2016-01-01", "64");
INSERT INTO "Team_Attributes" VALUES ("20", "1010", "2016-01-01", "68");