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_name" TEXT,
"winner_name" TEXT
);

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

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "USA");
INSERT INTO "players" VALUES ("2", "Venus", "Williams", "USA");
INSERT INTO "players" VALUES ("3", "Maria", "Sharapova", "RUS");
INSERT INTO "players" VALUES ("4", "Simona", "Halep", "ROU");
INSERT INTO "players" VALUES ("5", "Naomi", "Osaka", "JPN");
INSERT INTO "players" VALUES ("6", "Ashleigh", "Barty", "AUS");
INSERT INTO "players" VALUES ("7", "Petra", "Kvitova", "CZE");
INSERT INTO "players" VALUES ("8", "Angelique", "Kerber", "GER");
INSERT INTO "players" VALUES ("9", "Caroline", "Wozniacki", "DEN");
INSERT INTO "players" VALUES ("10", "Victoria", "Azarenka", "BLR");
INSERT INTO "matches" VALUES ("Maria Sharapova", "Serena Williams");
INSERT INTO "matches" VALUES ("Venus Williams", "Simona Halep");
INSERT INTO "matches" VALUES ("Naomi Osaka", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("Petra Kvitova", "Angelique Kerber");
INSERT INTO "matches" VALUES ("Caroline Wozniacki", "Victoria Azarenka");
INSERT INTO "matches" VALUES ("Serena Williams", "Simona Halep");
INSERT INTO "matches" VALUES ("Ashleigh Barty", "Naomi Osaka");
INSERT INTO "matches" VALUES ("Angelique Kerber", "Petra Kvitova");
INSERT INTO "matches" VALUES ("Victoria Azarenka", "Caroline Wozniacki");
INSERT INTO "matches" VALUES ("Simona Halep", "Serena Williams");
INSERT INTO "rankings" VALUES ("1", "250");
INSERT INTO "rankings" VALUES ("2", "180");
INSERT INTO "rankings" VALUES ("3", "200");
INSERT INTO "rankings" VALUES ("4", "260");
INSERT INTO "rankings" VALUES ("5", "220");
INSERT INTO "rankings" VALUES ("6", "230");
INSERT INTO "rankings" VALUES ("7", "190");
INSERT INTO "rankings" VALUES ("8", "210");
INSERT INTO "rankings" VALUES ("9", "170");
INSERT INTO "rankings" VALUES ("10", "160");