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

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

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





INSERT INTO "players" VALUES ("1", "Williams");
INSERT INTO "players" VALUES ("2", "Sharapova");
INSERT INTO "players" VALUES ("3", "Kvitova");
INSERT INTO "players" VALUES ("4", "Halep");
INSERT INTO "players" VALUES ("5", "Kerber");
INSERT INTO "players" VALUES ("6", "Svitolina");
INSERT INTO "players" VALUES ("7", "Bencic");
INSERT INTO "players" VALUES ("8", "Muguruza");
INSERT INTO "players" VALUES ("9", "Pliskova");
INSERT INTO "players" VALUES ("10", "Azarenka");
INSERT INTO "matches" VALUES ("1", "Williams", "3", "2500");
INSERT INTO "matches" VALUES ("2", "Sharapova", "5", "1800");
INSERT INTO "matches" VALUES ("3", "Kvitova", "2", "3000");
INSERT INTO "matches" VALUES ("4", "Halep", "7", "1500");
INSERT INTO "matches" VALUES ("5", "Kerber", "1", "3500");
INSERT INTO "matches" VALUES ("6", "Svitolina", "10", "900");
INSERT INTO "matches" VALUES ("7", "Bencic", "4", "2200");
INSERT INTO "matches" VALUES ("8", "Muguruza", "6", "1700");
INSERT INTO "matches" VALUES ("9", "Pliskova", "8", "1300");
INSERT INTO "matches" VALUES ("10", "Azarenka", "9", "1100");
INSERT INTO "rankings" VALUES ("1");
INSERT INTO "rankings" VALUES ("2");
INSERT INTO "rankings" VALUES ("3");
INSERT INTO "rankings" VALUES ("4");
INSERT INTO "rankings" VALUES ("5");
INSERT INTO "rankings" VALUES ("6");
INSERT INTO "rankings" VALUES ("7");
INSERT INTO "rankings" VALUES ("8");
INSERT INTO "rankings" VALUES ("9");
INSERT INTO "rankings" VALUES ("10");