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

CREATE TABLE "Match" (
"id" INT,
"league_id" INT,
"season" TEXT,
"date" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("league_id") REFERENCES "League"("id")
);

CREATE TABLE "Player" (
"id" INT,
"player_name" TEXT,
PRIMARY KEY ("id")
);

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



INSERT INTO "Country" VALUES ("1", "Scotland");
INSERT INTO "Country" VALUES ("2", "England");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "League" VALUES ("10", "1", "Scotland Premier League");
INSERT INTO "League" VALUES ("11", "1", "Scotland Championship");
INSERT INTO "League" VALUES ("20", "2", "English Premier League");
INSERT INTO "League" VALUES ("30", "3", "Bundesliga");
INSERT INTO "Match" VALUES ("100", "10", "2015/2016", "2015-08-01");
INSERT INTO "Match" VALUES ("101", "10", "2015/2016", "2015-09-15");
INSERT INTO "Match" VALUES ("102", "10", "2015/2016", "2016-04-10");
INSERT INTO "Match" VALUES ("103", "10", "2014/2015", "2015-03-20");
INSERT INTO "Match" VALUES ("104", "11", "2015/2016", "2015-10-05");
INSERT INTO "Match" VALUES ("105", "20", "2015/2016", "2015-11-11");
INSERT INTO "Match" VALUES ("106", "10", "2016/2017", "2016-09-01");
INSERT INTO "Match" VALUES ("107", "10", "2015/2016", "2016-05-01");
INSERT INTO "Match" VALUES ("108", "10", "2015/2016", "2015-12-20");
INSERT INTO "Match" VALUES ("109", "30", "2015/2016", "2015-08-22");
INSERT INTO "Player" VALUES ("1", "John Smith");
INSERT INTO "Player" VALUES ("2", "David Brown");
INSERT INTO "Player" VALUES ("3", "Michael Johnson");
INSERT INTO "Team" VALUES ("1", "Celtic FC");
INSERT INTO "Team" VALUES ("2", "Rangers FC");
INSERT INTO "Team" VALUES ("3", "Aberdeen FC");
INSERT INTO "Team" VALUES ("4", "Hearts FC");