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 "matches" (
"loser_id" INT,
"loser_ioc" TEXT,
"winner_id" INT,
FOREIGN KEY ("loser_id") REFERENCES "players"("player_id"),
FOREIGN KEY ("winner_id") REFERENCES "players"("player_id")
);

CREATE TABLE "players" (
"player_id" INT UNIQUE,
"country_code" TEXT,
PRIMARY KEY ("player_id")
);





INSERT INTO "players" VALUES ("1", "USA");
INSERT INTO "players" VALUES ("2", "ESP");
INSERT INTO "players" VALUES ("3", "FRA");
INSERT INTO "players" VALUES ("4", "USA");
INSERT INTO "players" VALUES ("5", "GER");
INSERT INTO "players" VALUES ("6", "ESP");
INSERT INTO "players" VALUES ("7", "FRA");
INSERT INTO "players" VALUES ("8", "ITA");
INSERT INTO "players" VALUES ("9", "GER");
INSERT INTO "players" VALUES ("10", "ITA");
INSERT INTO "players" VALUES ("11", "USA");
INSERT INTO "players" VALUES ("12", "BRA");
INSERT INTO "players" VALUES ("13", "BRA");
INSERT INTO "players" VALUES ("14", "JPN");
INSERT INTO "players" VALUES ("15", "JPN");
INSERT INTO "matches" VALUES ("2", "ESP", "1");
INSERT INTO "matches" VALUES ("3", "FRA", "4");
INSERT INTO "matches" VALUES ("5", "GER", "6");
INSERT INTO "matches" VALUES ("7", "FRA", "8");
INSERT INTO "matches" VALUES ("9", "GER", "10");
INSERT INTO "matches" VALUES ("11", "USA", "12");
INSERT INTO "matches" VALUES ("13", "BRA", "14");
INSERT INTO "matches" VALUES ("15", "JPN", "1");
INSERT INTO "matches" VALUES ("4", "USA", "5");
INSERT INTO "matches" VALUES ("6", "ESP", "7");
INSERT INTO "matches" VALUES ("8", "ITA", "9");
INSERT INTO "matches" VALUES ("10", "ITA", "11");
INSERT INTO "matches" VALUES ("12", "BRA", "13");
INSERT INTO "matches" VALUES ("14", "JPN", "15");
INSERT INTO "matches" VALUES ("1", "USA", "2");