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,
"winner_rank" INT,
FOREIGN KEY ("winner_id") REFERENCES "players"("player_id")
);

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

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





INSERT INTO "players" VALUES ("1", "Williams");
INSERT INTO "players" VALUES ("2", "Sharapova");
INSERT INTO "players" VALUES ("3", "Halep");
INSERT INTO "players" VALUES ("4", "Kerber");
INSERT INTO "players" VALUES ("5", "Svitolina");
INSERT INTO "players" VALUES ("6", "Pliskova");
INSERT INTO "players" VALUES ("7", "Bencic");
INSERT INTO "players" VALUES ("8", "Muguruza");
INSERT INTO "players" VALUES ("9", "Kvitova");
INSERT INTO "players" VALUES ("10", "Ostapenko");
INSERT INTO "matches" VALUES ("1", "3");
INSERT INTO "matches" VALUES ("2", "5");
INSERT INTO "matches" VALUES ("3", "1");
INSERT INTO "matches" VALUES ("4", "7");
INSERT INTO "matches" VALUES ("5", "4");
INSERT INTO "matches" VALUES ("6", "2");
INSERT INTO "matches" VALUES ("7", "6");
INSERT INTO "matches" VALUES ("8", "8");
INSERT INTO "matches" VALUES ("9", "9");
INSERT INTO "matches" VALUES ("10", "10");
INSERT INTO "matches" VALUES ("1", "3");
INSERT INTO "matches" VALUES ("3", "1");
INSERT INTO "matches" VALUES ("5", "4");
INSERT INTO "matches" VALUES ("7", "6");
INSERT INTO "matches" VALUES ("9", "9");
INSERT INTO "rankings" VALUES ("1", "8000");
INSERT INTO "rankings" VALUES ("2", "7500");
INSERT INTO "rankings" VALUES ("3", "7000");
INSERT INTO "rankings" VALUES ("4", "6500");
INSERT INTO "rankings" VALUES ("5", "6000");
INSERT INTO "rankings" VALUES ("6", "5500");
INSERT INTO "rankings" VALUES ("7", "5000");
INSERT INTO "rankings" VALUES ("8", "4500");
INSERT INTO "rankings" VALUES ("9", "4000");
INSERT INTO "rankings" VALUES ("10", "3500");