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", "FRA");
INSERT INTO "players" VALUES ("3", "USA");
INSERT INTO "players" VALUES ("4", "ESP");
INSERT INTO "players" VALUES ("5", "FRA");
INSERT INTO "players" VALUES ("6", "GER");
INSERT INTO "players" VALUES ("7", "ESP");
INSERT INTO "players" VALUES ("8", "GER");
INSERT INTO "players" VALUES ("9", "USA");
INSERT INTO "players" VALUES ("10", "ITA");
INSERT INTO "players" VALUES ("11", "ITA");
INSERT INTO "players" VALUES ("12", "BRA");
INSERT INTO "players" VALUES ("13", "BRA");
INSERT INTO "players" VALUES ("14", "FRA");
INSERT INTO "players" VALUES ("15", "USA");
INSERT INTO "matches" VALUES ("2", "FRA", "1");
INSERT INTO "matches" VALUES ("4", "ESP", "3");
INSERT INTO "matches" VALUES ("5", "FRA", "6");
INSERT INTO "matches" VALUES ("7", "ESP", "8");
INSERT INTO "matches" VALUES ("9", "USA", "10");
INSERT INTO "matches" VALUES ("11", "ITA", "12");
INSERT INTO "matches" VALUES ("13", "BRA", "14");
INSERT INTO "matches" VALUES ("15", "USA", "1");
INSERT INTO "matches" VALUES ("3", "USA", "5");
INSERT INTO "matches" VALUES ("6", "GER", "7");
INSERT INTO "matches" VALUES ("8", "GER", "9");
INSERT INTO "matches" VALUES ("10", "ITA", "11");
INSERT INTO "matches" VALUES ("12", "BRA", "13");
INSERT INTO "matches" VALUES ("14", "FRA", "15");
INSERT INTO "matches" VALUES ("1", "USA", "4");