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 "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", "Angelique", "Kerber");
INSERT INTO "players" VALUES ("9", "Caroline", "Wozniacki");
INSERT INTO "players" VALUES ("10", "Victoria", "Azarenka");
INSERT INTO "matches" VALUES ("Maria Sharapova", "Serena Williams");
INSERT INTO "matches" VALUES ("Venus Williams", "Simona Halep");
INSERT INTO "matches" VALUES ("Naomi Osaka", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("Petra Kvitova", "Serena Williams");
INSERT INTO "matches" VALUES ("Angelique Kerber", "Simona Halep");
INSERT INTO "matches" VALUES ("Caroline Wozniacki", "Naomi Osaka");
INSERT INTO "matches" VALUES ("Victoria Azarenka", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("Serena Williams", "Maria Sharapova");
INSERT INTO "matches" VALUES ("Simona Halep", "Venus Williams");
INSERT INTO "matches" VALUES ("Ashleigh Barty", "Naomi Osaka");
INSERT INTO "rankings" VALUES ("2023-01-01", "1", "1");
INSERT INTO "rankings" VALUES ("2023-01-01", "2", "2");
INSERT INTO "rankings" VALUES ("2023-01-01", "3", "3");
INSERT INTO "rankings" VALUES ("2023-01-01", "4", "4");
INSERT INTO "rankings" VALUES ("2023-01-01", "5", "5");
INSERT INTO "rankings" VALUES ("2023-01-01", "6", "6");
INSERT INTO "rankings" VALUES ("2023-01-01", "7", "7");
INSERT INTO "rankings" VALUES ("2023-01-01", "8", "8");
INSERT INTO "rankings" VALUES ("2023-01-01", "9", "9");
INSERT INTO "rankings" VALUES ("2023-01-01", "10", "10");
INSERT INTO "rankings" VALUES ("2023-02-01", "1", "1");
INSERT INTO "rankings" VALUES ("2023-02-01", "3", "2");
INSERT INTO "rankings" VALUES ("2023-02-01", "2", "3");
INSERT INTO "rankings" VALUES ("2023-02-01", "5", "4");
INSERT INTO "rankings" VALUES ("2023-02-01", "4", "5");
INSERT INTO "rankings" VALUES ("2023-02-01", "8", "6");
INSERT INTO "rankings" VALUES ("2023-02-01", "6", "7");
INSERT INTO "rankings" VALUES ("2023-02-01", "9", "8");
INSERT INTO "rankings" VALUES ("2023-02-01", "7", "9");
INSERT INTO "rankings" VALUES ("2023-02-01", "10", "10");
INSERT INTO "rankings" VALUES ("2023-03-01", "2", "1");
INSERT INTO "rankings" VALUES ("2023-03-01", "1", "2");
INSERT INTO "rankings" VALUES ("2023-03-01", "4", "3");
INSERT INTO "rankings" VALUES ("2023-03-01", "3", "4");
INSERT INTO "rankings" VALUES ("2023-03-01", "6", "5");
INSERT INTO "rankings" VALUES ("2023-03-01", "5", "6");
INSERT INTO "rankings" VALUES ("2023-03-01", "9", "7");
INSERT INTO "rankings" VALUES ("2023-03-01", "7", "8");
INSERT INTO "rankings" VALUES ("2023-03-01", "10", "9");
INSERT INTO "rankings" VALUES ("2023-03-01", "8", "10");
INSERT INTO "rankings" VALUES ("2023-04-01", "1", "1");
INSERT INTO "rankings" VALUES ("2023-04-01", "2", "2");
INSERT INTO "rankings" VALUES ("2023-04-01", "3", "3");
INSERT INTO "rankings" VALUES ("2023-04-01", "4", "4");
INSERT INTO "rankings" VALUES ("2023-04-01", "5", "5");
INSERT INTO "rankings" VALUES ("2023-04-01", "6", "6");
INSERT INTO "rankings" VALUES ("2023-04-01", "7", "7");
INSERT INTO "rankings" VALUES ("2023-04-01", "8", "8");
INSERT INTO "rankings" VALUES ("2023-04-01", "9", "9");
INSERT INTO "rankings" VALUES ("2023-04-01", "10", "10");