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_name" TEXT,
"winner_name" TEXT,
FOREIGN KEY ("loser_id") REFERENCES "players"("player_id")
);

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "1981-09-26");
INSERT INTO "players" VALUES ("2", "Venus", "Williams", "1980-06-17");
INSERT INTO "players" VALUES ("3", "Maria", "Sharapova", "1987-04-19");
INSERT INTO "players" VALUES ("4", "Simona", "Halep", "1991-09-27");
INSERT INTO "players" VALUES ("5", "Naomi", "Osaka", "1997-10-16");
INSERT INTO "players" VALUES ("6", "Ashleigh", "Barty", "1996-04-24");
INSERT INTO "players" VALUES ("7", "Angelique", "Kerber", "1988-01-18");
INSERT INTO "players" VALUES ("8", "Petra", "Kvitova", "1990-03-08");
INSERT INTO "players" VALUES ("9", "Bianca", "Andreescu", "2000-06-16");
INSERT INTO "players" VALUES ("10", "Iga", "Swiatek", "2001-05-31");
INSERT INTO "matches" VALUES ("3", "Maria Sharapova", "Serena Williams");
INSERT INTO "matches" VALUES ("4", "Simona Halep", "Venus Williams");
INSERT INTO "matches" VALUES ("5", "Naomi Osaka", "Simona Halep");
INSERT INTO "matches" VALUES ("6", "Ashleigh Barty", "Naomi Osaka");
INSERT INTO "matches" VALUES ("7", "Angelique Kerber", "Petra Kvitova");
INSERT INTO "matches" VALUES ("8", "Petra Kvitova", "Angelique Kerber");
INSERT INTO "matches" VALUES ("9", "Bianca Andreescu", "Iga Swiatek");
INSERT INTO "matches" VALUES ("10", "Iga Swiatek", "Ashleigh Barty");
INSERT INTO "matches" VALUES ("1", "Serena Williams", "Venus Williams");
INSERT INTO "matches" VALUES ("2", "Venus Williams", "Serena Williams");