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,
"match_num" INT,
"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,
"first_name" TEXT,
"last_name" TEXT,
PRIMARY KEY ("player_id")
);





INSERT INTO "players" VALUES ("1", "Serena", "Williams");
INSERT INTO "players" VALUES ("2", "Venus", "Williams");
INSERT INTO "players" VALUES ("3", "Maria", "Sharapova");
INSERT INTO "players" VALUES ("4", "Simona", "Halep");
INSERT INTO "players" VALUES ("5", "Naomi", "Osaka");
INSERT INTO "players" VALUES ("6", "Ashleigh", "Barty");
INSERT INTO "players" VALUES ("7", "Petra", "Kvitova");
INSERT INTO "players" VALUES ("8", "Sofia", "Kenin");
INSERT INTO "players" VALUES ("9", "Bianca", "Andreescu");
INSERT INTO "players" VALUES ("10", "Angelique", "Kerber");
INSERT INTO "matches" VALUES ("2", "101", "1");
INSERT INTO "matches" VALUES ("3", "102", "1");
INSERT INTO "matches" VALUES ("4", "103", "2");
INSERT INTO "matches" VALUES ("5", "104", "3");
INSERT INTO "matches" VALUES ("6", "105", "4");
INSERT INTO "matches" VALUES ("7", "106", "5");
INSERT INTO "matches" VALUES ("8", "107", "6");
INSERT INTO "matches" VALUES ("9", "108", "7");
INSERT INTO "matches" VALUES ("10", "109", "8");
INSERT INTO "matches" VALUES ("1", "110", "9");
INSERT INTO "matches" VALUES ("2", "111", "10");
INSERT INTO "matches" VALUES ("3", "112", "5");
INSERT INTO "matches" VALUES ("4", "113", "6");
INSERT INTO "matches" VALUES ("5", "114", "7");
INSERT INTO "matches" VALUES ("6", "115", "8");
INSERT INTO "matches" VALUES ("7", "116", "9");
INSERT INTO "matches" VALUES ("8", "117", "10");
INSERT INTO "matches" VALUES ("9", "118", "1");
INSERT INTO "matches" VALUES ("10", "119", "2");
INSERT INTO "matches" VALUES ("1", "120", "3");