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

CREATE TABLE "League" (
"id" INT,
"name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "Match" (
"id" INT,
"country_id" INT,
"season" TEXT,
"home_team_goal" INT,
"away_team_goal" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("id")
);

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



INSERT INTO "Country" VALUES ("1", "Poland");
INSERT INTO "Country" VALUES ("2", "Germany");
INSERT INTO "Country" VALUES ("3", "England");
INSERT INTO "Country" VALUES ("4", "Spain");
INSERT INTO "Country" VALUES ("5", "Italy");
INSERT INTO "League" VALUES ("101", "Ekstraklasa");
INSERT INTO "League" VALUES ("102", "Bundesliga");
INSERT INTO "League" VALUES ("103", "Premier League");
INSERT INTO "League" VALUES ("104", "La Liga");
INSERT INTO "League" VALUES ("105", "Serie A");
INSERT INTO "Match" VALUES ("1", "1", "2010/2011", "2", "1");
INSERT INTO "Match" VALUES ("2", "1", "2010/2011", "3", "0");
INSERT INTO "Match" VALUES ("3", "1", "2010/2011", "1", "1");
INSERT INTO "Match" VALUES ("4", "1", "2011/2012", "0", "2");
INSERT INTO "Match" VALUES ("5", "2", "2010/2011", "4", "1");
INSERT INTO "Match" VALUES ("6", "1", "2010/2011", "2", "2");
INSERT INTO "Match" VALUES ("7", "1", "2010/2011", "0", "0");
INSERT INTO "Match" VALUES ("8", "3", "2010/2011", "1", "0");
INSERT INTO "Match" VALUES ("9", "1", "2012/2013", "3", "1");
INSERT INTO "Match" VALUES ("10", "1", "2010/2011", "1", "2");
INSERT INTO "Team" VALUES ("1001", "Legia Warsaw");
INSERT INTO "Team" VALUES ("1002", "Lech Poznan");
INSERT INTO "Team" VALUES ("1003", "Wisla Krakow");
INSERT INTO "Team" VALUES ("1004", "Borussia Dortmund");
INSERT INTO "Team" VALUES ("1005", "Manchester United");