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", "Simona", "Halep", "ROU");
INSERT INTO "players" VALUES ("3", "Ashleigh", "Barty", "AUS");
INSERT INTO "players" VALUES ("4", "Naomi", "Osaka", "JPN");
INSERT INTO "players" VALUES ("5", "Victoria", "Azarenka", "BLR");
INSERT INTO "players" VALUES ("6", "Angelique", "Kerber", "GER");
INSERT INTO "players" VALUES ("7", "Caroline", "Wozniacki", "DEN");
INSERT INTO "players" VALUES ("8", "Petra", "Kvitova", "CZE");
INSERT INTO "players" VALUES ("9", "Maria", "Sharapova", "RUS");
INSERT INTO "players" VALUES ("10", "Garbiñe", "Muguruza", "ESP");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "1", "1");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "2", "2");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "3", "3");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "4", "4");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "1", "1");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "5", "5");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "6", "6");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "7", "7");
INSERT INTO "matches" VALUES ("Grand Slam", "French Open", "8", "8");
INSERT INTO "matches" VALUES ("Grand Slam", "Wimbledon", "9", "9");
INSERT INTO "matches" VALUES ("Grand Slam", "US Open", "10", "10");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "5", "5");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "2", "2");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "6", "6");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "3", "3");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "7", "7");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "4", "4");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "8", "8");
INSERT INTO "matches" VALUES ("Grand Slam", "Australian Open", "9", "9");
INSERT INTO "matches" VALUES ("WTA Championships", "WTA Championships", "10", "10");