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

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

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "1981-09-26");
INSERT INTO "players" VALUES ("2", "Simona", "Halep", "1991-09-27");
INSERT INTO "players" VALUES ("3", "Naomi", "Osaka", "1997-10-16");
INSERT INTO "players" VALUES ("4", "Ashleigh", "Barty", "1996-04-24");
INSERT INTO "players" VALUES ("5", "Petra", "Kvitova", "1990-03-08");
INSERT INTO "players" VALUES ("6", "Victoria", "Azarenka", "1989-07-31");
INSERT INTO "matches" VALUES ("1", "Serena Williams", "1", "8500");
INSERT INTO "matches" VALUES ("1", "Serena Williams", "1", "8500");
INSERT INTO "matches" VALUES ("1", "Serena Williams", "1", "8500");
INSERT INTO "matches" VALUES ("2", "Simona Halep", "2", "7000");
INSERT INTO "matches" VALUES ("2", "Simona Halep", "2", "7000");
INSERT INTO "matches" VALUES ("3", "Naomi Osaka", "3", "6500");
INSERT INTO "matches" VALUES ("3", "Naomi Osaka", "3", "6500");
INSERT INTO "matches" VALUES ("4", "Ashleigh Barty", "4", "6000");
INSERT INTO "matches" VALUES ("5", "Petra Kvitova", "5", "5500");
INSERT INTO "matches" VALUES ("6", "Victoria Azarenka", "6", "5000");
INSERT INTO "matches" VALUES ("6", "Victoria Azarenka", "6", "5000");
INSERT INTO "rankings" VALUES ("8500");
INSERT INTO "rankings" VALUES ("7000");
INSERT INTO "rankings" VALUES ("6500");
INSERT INTO "rankings" VALUES ("6000");
INSERT INTO "rankings" VALUES ("5500");
INSERT INTO "rankings" VALUES ("5000");