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,
"home_team_goal" INT,
"away_team_goal" 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,
"team_short_name" TEXT,
PRIMARY KEY ("id")
);



INSERT INTO "Team" VALUES ("1", "1001", "Real Madrid Club de Fútbol", "RMA");
INSERT INTO "Team" VALUES ("2", "1002", "Football Club Barcelona", "BAR");
INSERT INTO "Team" VALUES ("3", "1003", "Club Atlético de Madrid", "ATM");
INSERT INTO "Team" VALUES ("4", "1004", "Valencia Club de Fútbol", "VAL");
INSERT INTO "Team" VALUES ("5", "1005", "Sevilla Fútbol Club", "SEV");
INSERT INTO "Team" VALUES ("6", "1006", "Athletic Club", "ATH");
INSERT INTO "Team" VALUES ("7", "1007", "Villarreal Club de Fútbol", "VIL");
INSERT INTO "Team" VALUES ("8", "1008", "Real Sociedad de Fútbol", "RSO");
INSERT INTO "Team" VALUES ("9", "1009", "Real Betis Balompié", "BET");
INSERT INTO "Team" VALUES ("10", "1010", "Getafe Club de Fútbol", "GET");
INSERT INTO "Match" VALUES ("1", "1001", "1002", "2", "1");
INSERT INTO "Match" VALUES ("2", "1003", "1001", "0", "3");
INSERT INTO "Match" VALUES ("3", "1002", "1003", "4", "2");
INSERT INTO "Match" VALUES ("4", "1004", "1005", "1", "1");
INSERT INTO "Match" VALUES ("5", "1006", "1004", "2", "0");
INSERT INTO "Match" VALUES ("6", "1005", "1006", "3", "2");
INSERT INTO "Match" VALUES ("7", "1007", "1008", "0", "0");
INSERT INTO "Match" VALUES ("8", "1009", "1007", "1", "2");
INSERT INTO "Match" VALUES ("9", "1008", "1009", "2", "3");
INSERT INTO "Match" VALUES ("10", "1010", "1001", "0", "5");
INSERT INTO "Match" VALUES ("11", "1002", "1010", "3", "0");
INSERT INTO "Match" VALUES ("12", "1003", "1004", "1", "4");
INSERT INTO "Match" VALUES ("13", "1005", "1007", "2", "5");
INSERT INTO "Match" VALUES ("14", "1006", "1008", "1", "6");
INSERT INTO "Match" VALUES ("15", "1009", "1010", "0", "7");
INSERT INTO "Match" VALUES ("16", "1001", "1005", "3", "3");
INSERT INTO "Match" VALUES ("17", "1002", "1006", "2", "4");
INSERT INTO "Match" VALUES ("18", "1003", "1007", "1", "5");
INSERT INTO "Match" VALUES ("19", "1004", "1008", "0", "6");
INSERT INTO "Match" VALUES ("20", "1005", "1009", "2", "7");