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

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

CREATE TABLE "rankings" (
"ranking_date" DATE,
"ranking" INT,
"player_id" INT,
FOREIGN KEY ("player_id") REFERENCES "players"("player_id")
);





INSERT INTO "matches" VALUES ("Serena Williams", "Naomi Osaka");
INSERT INTO "matches" VALUES ("Simona Halep", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("Angelique Kerber", "Elina Svitolina");
INSERT INTO "matches" VALUES ("Karolina Pliskova", "Bianca Andreescu");
INSERT INTO "matches" VALUES ("Petra Kvitova", "Sofia Kenin");
INSERT INTO "matches" VALUES ("Aryna Sabalenka", "Victoria Azarenka");
INSERT INTO "matches" VALUES ("Garbiñe Muguruza", "Sloane Stephens");
INSERT INTO "matches" VALUES ("Madison Keys", "Johanna Konta");
INSERT INTO "matches" VALUES ("Belinda Bencic", "Kiki Bertens");
INSERT INTO "matches" VALUES ("Markéta Vondroušová", "Donna Vekić");
INSERT INTO "matches" VALUES ("Elise Mertens", "Maria Sakkari");
INSERT INTO "matches" VALUES ("Amanda Anisimova", "Dayana Yastremska");
INSERT INTO "matches" VALUES ("Barbora Krejčíková", "Ons Jabeur");
INSERT INTO "matches" VALUES ("Veronika Kudermetova", "Elena Rybakina");
INSERT INTO "matches" VALUES ("Daria Kasatkina", "Anastasia Pavlyuchenkova");
INSERT INTO "players" VALUES ("1", "Serena", "Williams");
INSERT INTO "players" VALUES ("2", "Naomi", "Osaka");
INSERT INTO "players" VALUES ("3", "Simona", "Halep");
INSERT INTO "players" VALUES ("4", "Ashleigh", "Barty");
INSERT INTO "players" VALUES ("5", "Angelique", "Kerber");
INSERT INTO "players" VALUES ("6", "Elina", "Svitolina");
INSERT INTO "players" VALUES ("7", "Karolina", "Pliskova");
INSERT INTO "players" VALUES ("8", "Bianca", "Andreescu");
INSERT INTO "players" VALUES ("9", "Petra", "Kvitova");
INSERT INTO "players" VALUES ("10", "Sofia", "Kenin");
INSERT INTO "players" VALUES ("11", "Aryna", "Sabalenka");
INSERT INTO "players" VALUES ("12", "Victoria", "Azarenka");
INSERT INTO "players" VALUES ("13", "Garbiñe", "Muguruza");
INSERT INTO "players" VALUES ("14", "Sloane", "Stephens");
INSERT INTO "players" VALUES ("15", "Madison", "Keys");
INSERT INTO "players" VALUES ("16", "Johanna", "Konta");
INSERT INTO "players" VALUES ("17", "Belinda", "Bencic");
INSERT INTO "players" VALUES ("18", "Kiki", "Bertens");
INSERT INTO "players" VALUES ("19", "Markéta", "Vondroušová");
INSERT INTO "players" VALUES ("20", "Donna", "Vekić");
INSERT INTO "players" VALUES ("21", "Elise", "Mertens");
INSERT INTO "players" VALUES ("22", "Maria", "Sakkari");
INSERT INTO "players" VALUES ("23", "Amanda", "Anisimova");
INSERT INTO "players" VALUES ("24", "Dayana", "Yastremska");
INSERT INTO "players" VALUES ("25", "Barbora", "Krejčíková");
INSERT INTO "players" VALUES ("26", "Ons", "Jabeur");
INSERT INTO "players" VALUES ("27", "Veronika", "Kudermetova");
INSERT INTO "players" VALUES ("28", "Elena", "Rybakina");
INSERT INTO "players" VALUES ("29", "Daria", "Kasatkina");
INSERT INTO "players" VALUES ("30", "Anastasia", "Pavlyuchenkova");
INSERT INTO "rankings" VALUES ("2023-01-01", "1", "2");
INSERT INTO "rankings" VALUES ("2023-01-01", "2", "4");
INSERT INTO "rankings" VALUES ("2023-01-01", "3", "3");
INSERT INTO "rankings" VALUES ("2023-01-01", "4", "1");
INSERT INTO "rankings" VALUES ("2023-01-01", "5", "10");
INSERT INTO "rankings" VALUES ("2023-01-01", "6", "7");
INSERT INTO "rankings" VALUES ("2023-01-01", "7", "9");
INSERT INTO "rankings" VALUES ("2023-01-01", "8", "6");
INSERT INTO "rankings" VALUES ("2023-01-01", "9", "11");
INSERT INTO "rankings" VALUES ("2023-01-01", "10", "8");
INSERT INTO "rankings" VALUES ("2023-01-01", "11", "18");
INSERT INTO "rankings" VALUES ("2023-01-01", "12", "17");
INSERT INTO "rankings" VALUES ("2023-01-01", "13", "13");
INSERT INTO "rankings" VALUES ("2023-01-01", "14", "15");
INSERT INTO "rankings" VALUES ("2023-01-01", "15", "5");
INSERT INTO "rankings" VALUES ("2023-02-01", "1", "2");
INSERT INTO "rankings" VALUES ("2023-02-01", "2", "4");
INSERT INTO "rankings" VALUES ("2023-02-01", "3", "1");
INSERT INTO "rankings" VALUES ("2023-02-01", "4", "3");
INSERT INTO "rankings" VALUES ("2023-02-01", "5", "10");
INSERT INTO "rankings" VALUES ("2023-02-01", "6", "9");
INSERT INTO "rankings" VALUES ("2023-02-01", "7", "7");
INSERT INTO "rankings" VALUES ("2023-02-01", "8", "11");
INSERT INTO "rankings" VALUES ("2023-02-01", "9", "6");
INSERT INTO "rankings" VALUES ("2023-02-01", "10", "8");
INSERT INTO "rankings" VALUES ("2023-02-01", "11", "17");
INSERT INTO "rankings" VALUES ("2023-02-01", "12", "18");
INSERT INTO "rankings" VALUES ("2023-02-01", "13", "15");
INSERT INTO "rankings" VALUES ("2023-02-01", "14", "13");
INSERT INTO "rankings" VALUES ("2023-02-01", "15", "5");
INSERT INTO "rankings" VALUES ("2023-03-01", "1", "2");
INSERT INTO "rankings" VALUES ("2023-03-01", "2", "1");
INSERT INTO "rankings" VALUES ("2023-03-01", "3", "4");
INSERT INTO "rankings" VALUES ("2023-03-01", "4", "3");
INSERT INTO "rankings" VALUES ("2023-03-01", "5", "10");
INSERT INTO "rankings" VALUES ("2023-03-01", "6", "9");
INSERT INTO "rankings" VALUES ("2023-03-01", "7", "7");
INSERT INTO "rankings" VALUES ("2023-03-01", "8", "11");
INSERT INTO "rankings" VALUES ("2023-03-01", "9", "6");
INSERT INTO "rankings" VALUES ("2023-03-01", "10", "8");
INSERT INTO "rankings" VALUES ("2023-03-01", "11", "17");
INSERT INTO "rankings" VALUES ("2023-03-01", "12", "18");
INSERT INTO "rankings" VALUES ("2023-03-01", "13", "15");
INSERT INTO "rankings" VALUES ("2023-03-01", "14", "13");
INSERT INTO "rankings" VALUES ("2023-03-01", "15", "5");
INSERT INTO "rankings" VALUES ("2023-01-01", "16", "12");
INSERT INTO "rankings" VALUES ("2023-01-01", "17", "14");
INSERT INTO "rankings" VALUES ("2023-01-01", "18", "16");
INSERT INTO "rankings" VALUES ("2023-01-01", "19", "19");
INSERT INTO "rankings" VALUES ("2023-01-01", "20", "20");
INSERT INTO "rankings" VALUES ("2023-01-01", "21", "21");
INSERT INTO "rankings" VALUES ("2023-01-01", "22", "22");
INSERT INTO "rankings" VALUES ("2023-01-01", "23", "23");
INSERT INTO "rankings" VALUES ("2023-01-01", "24", "24");
INSERT INTO "rankings" VALUES ("2023-01-01", "25", "25");
INSERT INTO "rankings" VALUES ("2023-01-01", "26", "26");
INSERT INTO "rankings" VALUES ("2023-01-01", "27", "27");
INSERT INTO "rankings" VALUES ("2023-01-01", "28", "28");
INSERT INTO "rankings" VALUES ("2023-01-01", "29", "29");
INSERT INTO "rankings" VALUES ("2023-01-01", "30", "30");
INSERT INTO "rankings" VALUES ("2023-02-01", "16", "14");
INSERT INTO "rankings" VALUES ("2023-02-01", "17", "12");
INSERT INTO "rankings" VALUES ("2023-02-01", "18", "16");
INSERT INTO "rankings" VALUES ("2023-02-01", "19", "20");
INSERT INTO "rankings" VALUES ("2023-02-01", "20", "19");
INSERT INTO "rankings" VALUES ("2023-02-01", "21", "22");
INSERT INTO "rankings" VALUES ("2023-02-01", "22", "21");
INSERT INTO "rankings" VALUES ("2023-02-01", "23", "24");
INSERT INTO "rankings" VALUES ("2023-02-01", "24", "23");
INSERT INTO "rankings" VALUES ("2023-02-01", "25", "26");
INSERT INTO "rankings" VALUES ("2023-02-01", "26", "25");
INSERT INTO "rankings" VALUES ("2023-02-01", "27", "28");
INSERT INTO "rankings" VALUES ("2023-02-01", "28", "27");
INSERT INTO "rankings" VALUES ("2023-02-01", "29", "30");
INSERT INTO "rankings" VALUES ("2023-02-01", "30", "29");
INSERT INTO "rankings" VALUES ("2023-03-01", "16", "12");
INSERT INTO "rankings" VALUES ("2023-03-01", "17", "14");
INSERT INTO "rankings" VALUES ("2023-03-01", "18", "16");
INSERT INTO "rankings" VALUES ("2023-03-01", "19", "19");
INSERT INTO "rankings" VALUES ("2023-03-01", "20", "20");
INSERT INTO "rankings" VALUES ("2023-03-01", "21", "21");
INSERT INTO "rankings" VALUES ("2023-03-01", "22", "22");
INSERT INTO "rankings" VALUES ("2023-03-01", "23", "23");
INSERT INTO "rankings" VALUES ("2023-03-01", "24", "24");
INSERT INTO "rankings" VALUES ("2023-03-01", "25", "25");
INSERT INTO "rankings" VALUES ("2023-03-01", "26", "26");
INSERT INTO "rankings" VALUES ("2023-03-01", "27", "27");
INSERT INTO "rankings" VALUES ("2023-03-01", "28", "28");
INSERT INTO "rankings" VALUES ("2023-03-01", "29", "29");
INSERT INTO "rankings" VALUES ("2023-03-01", "30", "30");