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,
"country_code" TEXT,
PRIMARY KEY ("player_id")
);

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





INSERT INTO "players" VALUES ("1", "Serena", "USA");
INSERT INTO "players" VALUES ("2", "Simona", "ROU");
INSERT INTO "players" VALUES ("3", "Naomi", "JPN");
INSERT INTO "players" VALUES ("4", "Ashleigh", "AUS");
INSERT INTO "players" VALUES ("5", "Petra", "CZE");
INSERT INTO "players" VALUES ("6", "Elina", "FIN");
INSERT INTO "players" VALUES ("7", "Karolina", "POL");
INSERT INTO "players" VALUES ("8", "Sloane", "USA");
INSERT INTO "players" VALUES ("9", "Bianca", "ROU");
INSERT INTO "players" VALUES ("10", "Garbiñe", "ESP");
INSERT INTO "rankings" VALUES ("1", "8500", "15");
INSERT INTO "rankings" VALUES ("2", "7200", "18");
INSERT INTO "rankings" VALUES ("3", "9000", "20");
INSERT INTO "rankings" VALUES ("4", "6800", "12");
INSERT INTO "rankings" VALUES ("5", "7500", "20");
INSERT INTO "rankings" VALUES ("6", "6000", "10");
INSERT INTO "rankings" VALUES ("7", "7100", "18");
INSERT INTO "rankings" VALUES ("8", "6700", "14");
INSERT INTO "rankings" VALUES ("9", "6900", "20");
INSERT INTO "rankings" VALUES ("10", "7300", "16");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("5");
INSERT INTO "matches" VALUES ("9");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("2");
INSERT INTO "matches" VALUES ("7");
INSERT INTO "matches" VALUES ("1");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("9");
INSERT INTO "matches" VALUES ("5");
INSERT INTO "matches" VALUES ("9");
INSERT INTO "matches" VALUES ("3");
INSERT INTO "matches" VALUES ("10");
INSERT INTO "matches" VALUES ("2");
INSERT INTO "matches" VALUES ("7");