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" (
"tourney_date" DATE
);

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

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





INSERT INTO "matches" VALUES ("2023-01-01");
INSERT INTO "matches" VALUES ("2023-02-01");
INSERT INTO "matches" VALUES ("2023-03-01");
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", "Iga", "Swiatek");
INSERT INTO "players" VALUES ("6", "Coco", "Gauff");
INSERT INTO "players" VALUES ("7", "PlayerZero", "NoPoints");
INSERT INTO "players" VALUES ("8", "SingleEntry", "OneRanking");
INSERT INTO "rankings" VALUES ("1", "1", "5000");
INSERT INTO "rankings" VALUES ("2", "1", "3000");
INSERT INTO "rankings" VALUES ("3", "2", "4000");
INSERT INTO "rankings" VALUES ("4", "2", "3500");
INSERT INTO "rankings" VALUES ("5", "2", "1500");
INSERT INTO "rankings" VALUES ("6", "3", "4200");
INSERT INTO "rankings" VALUES ("7", "3", "0");
INSERT INTO "rankings" VALUES ("8", "4", "6000");
INSERT INTO "rankings" VALUES ("9", "4", "2000");
INSERT INTO "rankings" VALUES ("10", "5", "7000");
INSERT INTO "rankings" VALUES ("11", "5", "1000");
INSERT INTO "rankings" VALUES ("12", "5", "3000");
INSERT INTO "rankings" VALUES ("13", "6", "2500");
INSERT INTO "rankings" VALUES ("14", "6", "2500");
INSERT INTO "rankings" VALUES ("15", "8", "1234");