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", "Venus", "Williams", "1980-06-17", "USA");
INSERT INTO "players" VALUES ("3", "Naomi", "Osaka", "1997-10-16", "JPN");
INSERT INTO "players" VALUES ("4", "Ashleigh", "Barty", "1996-04-24", "AUS");
INSERT INTO "players" VALUES ("5", "Simona", "Halep", "1991-09-27", "ROU");
INSERT INTO "players" VALUES ("6", "Maria", "Sharapova", "1987-04-19", "RUS");
INSERT INTO "players" VALUES ("7", "Petra", "Kvitova", "1990-03-08", "CZE");
INSERT INTO "players" VALUES ("8", "Angelique", "Kerber", "1988-01-18", "GER");
INSERT INTO "players" VALUES ("9", "Caroline", "Wozniacki", "1990-07-11", "DEN");
INSERT INTO "players" VALUES ("10", "Victoria", "Azarenka", "1989-07-31", "BLR");
INSERT INTO "matches" VALUES ("2", "500", "1", "1000");
INSERT INTO "matches" VALUES ("3", "600", "1", "1200");
INSERT INTO "matches" VALUES ("1", "800", "4", "900");
INSERT INTO "matches" VALUES ("5", "700", "3", "1100");
INSERT INTO "matches" VALUES ("6", "400", "5", "850");
INSERT INTO "matches" VALUES ("7", "300", "6", "750");
INSERT INTO "matches" VALUES ("8", "200", "7", "650");
INSERT INTO "matches" VALUES ("9", "100", "8", "550");
INSERT INTO "matches" VALUES ("10", "50", "9", "450");
INSERT INTO "matches" VALUES ("4", "950", "10", "1300");
INSERT INTO "matches" VALUES ("1", "1100", "2", "1500");
INSERT INTO "matches" VALUES ("3", "1000", "4", "1400");
INSERT INTO "matches" VALUES ("5", "900", "1", "1600");
INSERT INTO "matches" VALUES ("6", "800", "3", "1350");
INSERT INTO "matches" VALUES ("7", "700", "5", "1250");
INSERT INTO "matches" VALUES ("8", "600", "6", "1150");
INSERT INTO "matches" VALUES ("9", "500", "7", "1050");
INSERT INTO "matches" VALUES ("10", "400", "8", "950");
INSERT INTO "matches" VALUES ("2", "1200", "9", "1700");
INSERT INTO "matches" VALUES ("4", "1300", "10", "1800");