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