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

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "USA");
INSERT INTO "players" VALUES ("2", "Victoria", "Azarenka", "BLR");
INSERT INTO "players" VALUES ("3", "Simona", "Halep", "ROU");
INSERT INTO "players" VALUES ("4", "Angelique", "Kerber", "GER");
INSERT INTO "players" VALUES ("5", "Caroline", "Wozniacki", "DEN");
INSERT INTO "players" VALUES ("6", "Maria", "Sharapova", "RUS");
INSERT INTO "players" VALUES ("7", "Naomi", "Osaka", "JPN");
INSERT INTO "players" VALUES ("8", "Petra", "Kvitova", "CZE");
INSERT INTO "players" VALUES ("9", "Ashleigh", "Barty", "AUS");
INSERT INTO "players" VALUES ("10", "Garbiñe", "Muguruza", "ESP");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2015", "1", "1");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2016", "4", "2");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2017", "9", "3");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2015", "1", "1");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2016", "2", "3");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2017", "9", "2");
INSERT INTO "matches" VALUES ("Grand Slam", "French Open 2017", "3", "1");
INSERT INTO "matches" VALUES ("Grand Slam", "Wimbledon 2017", "8", "1");
INSERT INTO "matches" VALUES ("Grand Slam", "US Open 2017", "7", "1");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2018", "5", "4");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2018", "5", "5");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2019", "6", "6");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2019", "10", "7");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships 2020", "3", "8");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open 2020", "4", "9");