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 "Match" (
"id" INT,
"country_id" INT,
"league_id" INT,
"home_team_api_id" INT,
"away_team_api_id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("country_id") REFERENCES "Country"("id")
);

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

CREATE TABLE "Player_Attributes" (
"id" INT,
"player_api_id" INT,
"overall_rating" INT,
"vision" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("player_api_id") REFERENCES "Player"("player_api_id")
);



INSERT INTO "Country" VALUES ("1", "England");
INSERT INTO "Country" VALUES ("2", "Spain");
INSERT INTO "Country" VALUES ("3", "Germany");
INSERT INTO "Country" VALUES ("4", "Italy");
INSERT INTO "Match" VALUES ("101", "1", "10", "1001", "1002");
INSERT INTO "Match" VALUES ("102", "1", "10", "1003", "1004");
INSERT INTO "Match" VALUES ("103", "2", "20", "2001", "2002");
INSERT INTO "Match" VALUES ("104", "2", "20", "2003", "2004");
INSERT INTO "Match" VALUES ("105", "3", "30", "3001", "3002");
INSERT INTO "Match" VALUES ("106", "3", "30", "3003", "3004");
INSERT INTO "Match" VALUES ("107", "4", "40", "4001", "4002");
INSERT INTO "Match" VALUES ("108", "4", "40", "4003", "4004");
INSERT INTO "Player" VALUES ("1", "1001", "John Smith");
INSERT INTO "Player" VALUES ("2", "1002", "Alex Johnson");
INSERT INTO "Player" VALUES ("3", "1003", "Michael Brown");
INSERT INTO "Player" VALUES ("4", "1004", "Chris Davis");
INSERT INTO "Player" VALUES ("5", "2001", "Luis Garcia");
INSERT INTO "Player" VALUES ("6", "2002", "Carlos Martinez");
INSERT INTO "Player" VALUES ("7", "2003", "Javier Hernandez");
INSERT INTO "Player" VALUES ("8", "2004", "Sergio Ramos");
INSERT INTO "Player" VALUES ("9", "3001", "Thomas Muller");
INSERT INTO "Player" VALUES ("10", "3002", "Manuel Neuer");
INSERT INTO "Player" VALUES ("11", "3003", "Mesut Ozil");
INSERT INTO "Player" VALUES ("12", "3004", "Toni Kroos");
INSERT INTO "Player" VALUES ("13", "4001", "Francesco Totti");
INSERT INTO "Player" VALUES ("14", "4002", "Andrea Pirlo");
INSERT INTO "Player" VALUES ("15", "4003", "Gianluigi Buffon");
INSERT INTO "Player" VALUES ("16", "4004", "Alessandro Del Piero");
INSERT INTO "Player_Attributes" VALUES ("1", "1001", "85", "88");
INSERT INTO "Player_Attributes" VALUES ("2", "1002", "90", "91");
INSERT INTO "Player_Attributes" VALUES ("3", "1003", "78", "89");
INSERT INTO "Player_Attributes" VALUES ("4", "1004", "82", "92");
INSERT INTO "Player_Attributes" VALUES ("5", "2001", "88", "90");
INSERT INTO "Player_Attributes" VALUES ("6", "2002", "87", "87");
INSERT INTO "Player_Attributes" VALUES ("7", "2003", "91", "93");
INSERT INTO "Player_Attributes" VALUES ("8", "2004", "89", "85");
INSERT INTO "Player_Attributes" VALUES ("9", "3001", "86", "90");
INSERT INTO "Player_Attributes" VALUES ("10", "3002", "92", "88");
INSERT INTO "Player_Attributes" VALUES ("11", "3003", "90", "95");
INSERT INTO "Player_Attributes" VALUES ("12", "3004", "88", "89");
INSERT INTO "Player_Attributes" VALUES ("13", "4001", "87", "91");
INSERT INTO "Player_Attributes" VALUES ("14", "4002", "89", "90");
INSERT INTO "Player_Attributes" VALUES ("15", "4003", "85", "86");
INSERT INTO "Player_Attributes" VALUES ("16", "4004", "90", "94");