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,
"away_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("away_team_api_id") REFERENCES "Team"("team_api_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,
PRIMARY KEY ("id")
);

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



INSERT INTO "Team" VALUES ("1", "1001", "Real Madrid");
INSERT INTO "Team" VALUES ("2", "1002", "FC Barcelona");
INSERT INTO "Team" VALUES ("3", "1003", "Manchester United");
INSERT INTO "Team" VALUES ("4", "1004", "Bayern Munich");
INSERT INTO "Team" VALUES ("5", "1005", "Juventus");
INSERT INTO "Team" VALUES ("6", "1006", "Paris Saint-Germain");
INSERT INTO "Team" VALUES ("7", "1007", "Liverpool FC");
INSERT INTO "Team" VALUES ("8", "1008", "Chelsea FC");
INSERT INTO "Team" VALUES ("9", "1009", "Arsenal FC");
INSERT INTO "Team" VALUES ("10", "1010", "Borussia Dortmund");
INSERT INTO "Team_Attributes" VALUES ("1", "1001", "2012-01-01", "50", "60");
INSERT INTO "Team_Attributes" VALUES ("2", "1002", "2012-03-15", "65", "75");
INSERT INTO "Team_Attributes" VALUES ("3", "1003", "2012-06-20", "45", "55");
INSERT INTO "Team_Attributes" VALUES ("4", "1004", "2012-09-10", "70", "80");
INSERT INTO "Team_Attributes" VALUES ("5", "1005", "2012-11-05", "55", "65");
INSERT INTO "Team_Attributes" VALUES ("6", "1006", "2012-02-28", "60", "70");
INSERT INTO "Team_Attributes" VALUES ("7", "1007", "2012-04-10", "52", "62");
INSERT INTO "Team_Attributes" VALUES ("8", "1008", "2012-07-01", "48", "58");
INSERT INTO "Team_Attributes" VALUES ("9", "1009", "2012-10-25", "68", "78");
INSERT INTO "Team_Attributes" VALUES ("10", "1010", "2012-12-12", "58", "68");
INSERT INTO "Team_Attributes" VALUES ("11", "1001", "2013-01-01", "55", "65");
INSERT INTO "Team_Attributes" VALUES ("12", "1002", "2011-03-15", "60", "70");
INSERT INTO "Team_Attributes" VALUES ("13", "1003", "2012-05-01", "40", "50");
INSERT INTO "Team_Attributes" VALUES ("14", "1004", "2012-08-01", "72", "82");
INSERT INTO "Team_Attributes" VALUES ("15", "1005", "2012-10-01", "53", "63");
INSERT INTO "Team_Attributes" VALUES ("16", "1006", "2012-03-01", "62", "72");
INSERT INTO "Team_Attributes" VALUES ("17", "1007", "2012-05-15", "50", "60");
INSERT INTO "Team_Attributes" VALUES ("18", "1008", "2012-08-20", "46", "56");
INSERT INTO "Team_Attributes" VALUES ("19", "1009", "2012-11-10", "70", "80");
INSERT INTO "Team_Attributes" VALUES ("20", "1010", "2012-12-20", "56", "66");
INSERT INTO "Team_Attributes" VALUES ("21", "1001", "2012-06-01", "51", "NULL");
INSERT INTO "Team_Attributes" VALUES ("22", "1002", "2012-09-01", "66", "76");
INSERT INTO "Team_Attributes" VALUES ("23", "1003", "2012-11-01", "44", "54");
INSERT INTO "Team_Attributes" VALUES ("24", "1004", "2012-01-15", "71", "81");
INSERT INTO "Team_Attributes" VALUES ("25", "1005", "2012-04-01", "54", "64");
INSERT INTO "Match" VALUES ("1", "1001", "1002");
INSERT INTO "Match" VALUES ("2", "1003", "1004");
INSERT INTO "Match" VALUES ("3", "1005", "1006");
INSERT INTO "Match" VALUES ("4", "1007", "1008");
INSERT INTO "Match" VALUES ("5", "1009", "1010");