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" (
"winner_id" INT,
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")
);

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





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", "Petra", "Kvitova");
INSERT INTO "players" VALUES ("6", "Sofia", "Kenin");
INSERT INTO "players" VALUES ("7", "Bianca", "Andreescu");
INSERT INTO "players" VALUES ("8", "Elina", "Svitolina");
INSERT INTO "rankings" VALUES ("1", "1", "8500");
INSERT INTO "rankings" VALUES ("2", "1", "8300");
INSERT INTO "rankings" VALUES ("3", "1", "8100");
INSERT INTO "rankings" VALUES ("1", "2", "9000");
INSERT INTO "rankings" VALUES ("2", "2", "8800");
INSERT INTO "rankings" VALUES ("3", "2", "8600");
INSERT INTO "rankings" VALUES ("4", "3", "7000");
INSERT INTO "rankings" VALUES ("5", "3", "6800");
INSERT INTO "rankings" VALUES ("6", "3", "6600");
INSERT INTO "rankings" VALUES ("2", "4", "7200");
INSERT INTO "rankings" VALUES ("3", "4", "7100");
INSERT INTO "rankings" VALUES ("4", "4", "7000");
INSERT INTO "rankings" VALUES ("5", "5", "6500");
INSERT INTO "rankings" VALUES ("6", "5", "6400");
INSERT INTO "rankings" VALUES ("7", "5", "6300");
INSERT INTO "rankings" VALUES ("1", "6", "7800");
INSERT INTO "rankings" VALUES ("2", "6", "7700");
INSERT INTO "rankings" VALUES ("3", "6", "7600");
INSERT INTO "rankings" VALUES ("4", "7", "6900");
INSERT INTO "rankings" VALUES ("5", "7", "6800");
INSERT INTO "rankings" VALUES ("6", "7", "6700");
INSERT INTO "rankings" VALUES ("7", "8", "6400");
INSERT INTO "rankings" VALUES ("8", "8", "6300");
INSERT INTO "rankings" VALUES ("9", "8", "6200");
INSERT INTO "matches" VALUES ("1");
INSERT INTO "matches" VALUES ("2");
INSERT INTO "matches" VALUES ("2");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("4");
INSERT INTO "matches" VALUES ("4");
INSERT INTO "matches" VALUES ("5");
INSERT INTO "matches" VALUES ("6");
INSERT INTO "matches" VALUES ("7");
INSERT INTO "matches" VALUES ("8");
INSERT INTO "matches" VALUES ("8");
INSERT INTO "matches" VALUES ("1");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("5");
INSERT INTO "matches" VALUES ("7");