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_id" INT,
"loser_rank_points" INT,
"winner_id" INT,
"winner_rank_points" INT,
FOREIGN KEY ("loser_id") REFERENCES "players"("player_id"),
FOREIGN KEY ("winner_id") REFERENCES "players"("player_id")
);

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "1981-09-26", "USA");
INSERT INTO "players" VALUES ("2", "Naomi", "Osaka", "1997-10-16", "JPN");
INSERT INTO "players" VALUES ("3", "Ashleigh", "Barty", "1996-04-24", "AUS");
INSERT INTO "players" VALUES ("4", "Simona", "Halep", "1991-09-27", "ROU");
INSERT INTO "players" VALUES ("5", "Aryna", "Sabalenka", "1998-05-05", "BLR");
INSERT INTO "players" VALUES ("6", "Iga", "Swiatek", "2001-05-31", "POL");
INSERT INTO "players" VALUES ("7", "Coco", "Gauff", "2004-03-13", "USA");
INSERT INTO "players" VALUES ("8", "Emma", "Raducanu", "2002-11-13", "GBR");
INSERT INTO "players" VALUES ("9", "Leylah", "Fernandez", "2002-09-06", "CAN");
INSERT INTO "players" VALUES ("10", "Ons", "Jabeur", "1994-08-28", "TUN");
INSERT INTO "matches" VALUES ("2", "8500", "1", "9000");
INSERT INTO "matches" VALUES ("3", "7800", "2", "8600");
INSERT INTO "matches" VALUES ("4", "7500", "3", "7900");
INSERT INTO "matches" VALUES ("5", "7000", "4", "7600");
INSERT INTO "matches" VALUES ("6", "6500", "5", "7100");
INSERT INTO "matches" VALUES ("7", "6000", "6", "6600");
INSERT INTO "matches" VALUES ("8", "5500", "7", "6100");
INSERT INTO "matches" VALUES ("9", "5000", "8", "5600");
INSERT INTO "matches" VALUES ("10", "4500", "9", "5100");
INSERT INTO "matches" VALUES ("1", "8900", "10", "4600");
INSERT INTO "matches" VALUES ("3", "7700", "1", "9100");
INSERT INTO "matches" VALUES ("4", "7400", "2", "8700");
INSERT INTO "matches" VALUES ("5", "6900", "3", "8000");
INSERT INTO "matches" VALUES ("6", "6400", "4", "7700");
INSERT INTO "matches" VALUES ("7", "5900", "5", "7200");
INSERT INTO "matches" VALUES ("8", "5400", "6", "6700");
INSERT INTO "matches" VALUES ("9", "4900", "7", "6200");
INSERT INTO "matches" VALUES ("10", "4400", "8", "5700");
INSERT INTO "matches" VALUES ("1", "9050", "9", "5200");
INSERT INTO "matches" VALUES ("2", "8550", "10", "4700");