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,
"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,
"birth_date" DATE,
"country_code" TEXT,
PRIMARY KEY ("player_id")
);

CREATE TABLE "rankings" (
"ranking" INT
);





INSERT INTO "players" VALUES ("1", "Serena", "1981-09-26", "USA");
INSERT INTO "players" VALUES ("2", "Venus", "1980-06-17", "USA");
INSERT INTO "players" VALUES ("3", "Maria", "1987-06-19", "RUS");
INSERT INTO "players" VALUES ("4", "Simona", "1990-04-27", "ROU");
INSERT INTO "players" VALUES ("5", "Naomi", "1997-10-16", "JPN");
INSERT INTO "players" VALUES ("6", "Ashleigh", "1996-04-24", "AUS");
INSERT INTO "players" VALUES ("7", "Petra", "1990-06-08", "CZE");
INSERT INTO "players" VALUES ("8", "Bianca", "1996-06-30", "ROU");
INSERT INTO "players" VALUES ("9", "Garbiñe", "1993-06-08", "ESP");
INSERT INTO "players" VALUES ("10", "Elina", "1997-12-17", "FIN");
INSERT INTO "matches" VALUES ("2", "1", "2500");
INSERT INTO "matches" VALUES ("3", "1", "2600");
INSERT INTO "matches" VALUES ("4", "1", "2700");
INSERT INTO "matches" VALUES ("5", "1", "2800");
INSERT INTO "matches" VALUES ("6", "2", "2400");
INSERT INTO "matches" VALUES ("7", "2", "2300");
INSERT INTO "matches" VALUES ("8", "3", "2200");
INSERT INTO "matches" VALUES ("9", "3", "2100");
INSERT INTO "matches" VALUES ("10", "4", "2000");
INSERT INTO "matches" VALUES ("1", "5", "1900");
INSERT INTO "matches" VALUES ("2", "5", "1950");
INSERT INTO "matches" VALUES ("3", "6", "1850");
INSERT INTO "matches" VALUES ("4", "7", "1800");
INSERT INTO "matches" VALUES ("5", "8", "1750");
INSERT INTO "matches" VALUES ("6", "9", "1700");
INSERT INTO "matches" VALUES ("7", "10", "1650");
INSERT INTO "matches" VALUES ("8", "1", "1600");
INSERT INTO "matches" VALUES ("9", "1", "1550");
INSERT INTO "matches" VALUES ("10", "1", "1500");
INSERT INTO "rankings" VALUES ("1");
INSERT INTO "rankings" VALUES ("2");
INSERT INTO "rankings" VALUES ("3");
INSERT INTO "rankings" VALUES ("4");
INSERT INTO "rankings" VALUES ("5");
INSERT INTO "rankings" VALUES ("6");
INSERT INTO "rankings" VALUES ("7");
INSERT INTO "rankings" VALUES ("8");
INSERT INTO "rankings" VALUES ("9");
INSERT INTO "rankings" VALUES ("10");