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_id" INT,
"loser_rank" INT,
FOREIGN KEY ("loser_id") REFERENCES "players"("player_id")
);

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

CREATE TABLE "rankings" (
"ranking_points" INT
);





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "R");
INSERT INTO "players" VALUES ("2", "Venus", "Williams", "L");
INSERT INTO "players" VALUES ("3", "Simona", "Halep", "R");
INSERT INTO "players" VALUES ("4", "Naomi", "Osaka", "R");
INSERT INTO "players" VALUES ("5", "Ashleigh", "Barty", "L");
INSERT INTO "players" VALUES ("6", "Bianca", "Andreescu", "R");
INSERT INTO "players" VALUES ("7", "Sloane", "Stephens", "R");
INSERT INTO "players" VALUES ("8", "Petra", "Kvitova", "L");
INSERT INTO "players" VALUES ("9", "Angelique", "Kerber", "L");
INSERT INTO "players" VALUES ("10", "Garbiñe", "Muguruza", "R");
INSERT INTO "matches" VALUES ("1", "3");
INSERT INTO "matches" VALUES ("2", "5");
INSERT INTO "matches" VALUES ("3", "1");
INSERT INTO "matches" VALUES ("4", "2");
INSERT INTO "matches" VALUES ("5", "4");
INSERT INTO "matches" VALUES ("6", "1");
INSERT INTO "matches" VALUES ("7", "3");
INSERT INTO "matches" VALUES ("8", "2");
INSERT INTO "matches" VALUES ("9", "3");
INSERT INTO "matches" VALUES ("10", "4");
INSERT INTO "matches" VALUES ("1", "1");
INSERT INTO "matches" VALUES ("2", "1");
INSERT INTO "matches" VALUES ("3", "NULL");
INSERT INTO "matches" VALUES ("4", "7");
INSERT INTO "matches" VALUES ("5", "6");
INSERT INTO "matches" VALUES ("6", "5");
INSERT INTO "matches" VALUES ("7", "5");
INSERT INTO "matches" VALUES ("8", "3");
INSERT INTO "matches" VALUES ("9", "2");
INSERT INTO "matches" VALUES ("10", "1");
INSERT INTO "rankings" VALUES ("1000");
INSERT INTO "rankings" VALUES ("850");
INSERT INTO "rankings" VALUES ("1200");
INSERT INTO "rankings" VALUES ("900");
INSERT INTO "rankings" VALUES ("1100");