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_name" TEXT,
"winner_ioc" TEXT,
"winner_name" TEXT
);

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

CREATE TABLE "rankings" (
"player_id" INT,
"tours" INT,
FOREIGN KEY ("player_id") REFERENCES "players"("player_id")
);





INSERT INTO "matches" VALUES ("Serena Williams", "USA", "Venus Williams");
INSERT INTO "matches" VALUES ("Maria Sharapova", "RUS", "Simona Halep");
INSERT INTO "matches" VALUES ("Naomi Osaka", "JPN", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("Petra Kvitova", "CZE", "Karolina Pliskova");
INSERT INTO "matches" VALUES ("Angelique Kerber", "GER", "Elina Svitolina");
INSERT INTO "matches" VALUES ("Victoria Azarenka", "BLR", "Garbine Muguruza");
INSERT INTO "matches" VALUES ("Bianca Andreescu", "CAN", "Sofia Kenin");
INSERT INTO "matches" VALUES ("Coco Gauff", "USA", "Aryna Sabalenka");
INSERT INTO "matches" VALUES ("Iga Swiatek", "POL", "Ons Jabeur");
INSERT INTO "matches" VALUES ("Leylah Fernandez", "CAN", "Emma Raducanu");
INSERT INTO "players" VALUES ("1", "Serena", "USA");
INSERT INTO "players" VALUES ("2", "Venus", "USA");
INSERT INTO "players" VALUES ("3", "Maria", "RUS");
INSERT INTO "players" VALUES ("4", "Simona", "ROU");
INSERT INTO "players" VALUES ("5", "Naomi", "JPN");
INSERT INTO "players" VALUES ("6", "Ashleigh", "AUS");
INSERT INTO "players" VALUES ("7", "Petra", "CZE");
INSERT INTO "players" VALUES ("8", "Karolina", "CZE");
INSERT INTO "players" VALUES ("9", "Angelique", "GER");
INSERT INTO "players" VALUES ("10", "Elina", "UKR");
INSERT INTO "players" VALUES ("11", "Victoria", "BLR");
INSERT INTO "players" VALUES ("12", "Garbine", "ESP");
INSERT INTO "players" VALUES ("13", "Bianca", "CAN");
INSERT INTO "players" VALUES ("14", "Sofia", "USA");
INSERT INTO "players" VALUES ("15", "Coco", "USA");
INSERT INTO "players" VALUES ("16", "Aryna", "BLR");
INSERT INTO "players" VALUES ("17", "Iga", "POL");
INSERT INTO "players" VALUES ("18", "Ons", "TUN");
INSERT INTO "players" VALUES ("19", "Leylah", "CAN");
INSERT INTO "players" VALUES ("20", "Emma", "GBR");
INSERT INTO "players" VALUES ("21", "Svetlana", "RUS");
INSERT INTO "players" VALUES ("22", "Caroline", "DEN");
INSERT INTO "rankings" VALUES ("1", "15");
INSERT INTO "rankings" VALUES ("2", "12");
INSERT INTO "rankings" VALUES ("3", "18");
INSERT INTO "rankings" VALUES ("4", "16");
INSERT INTO "rankings" VALUES ("5", "10");
INSERT INTO "rankings" VALUES ("6", "14");
INSERT INTO "rankings" VALUES ("7", "17");
INSERT INTO "rankings" VALUES ("8", "13");
INSERT INTO "rankings" VALUES ("9", "11");
INSERT INTO "rankings" VALUES ("10", "9");
INSERT INTO "rankings" VALUES ("11", "8");
INSERT INTO "rankings" VALUES ("12", "7");
INSERT INTO "rankings" VALUES ("13", "6");
INSERT INTO "rankings" VALUES ("14", "5");
INSERT INTO "rankings" VALUES ("15", "4");
INSERT INTO "rankings" VALUES ("16", "3");
INSERT INTO "rankings" VALUES ("17", "2");
INSERT INTO "rankings" VALUES ("18", "1");
INSERT INTO "rankings" VALUES ("19", "19");
INSERT INTO "rankings" VALUES ("20", "20");
INSERT INTO "rankings" VALUES ("21", "18");
INSERT INTO "rankings" VALUES ("22", "18");