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" (
"tourney_date" DATE,
"tourney_name" TEXT,
"winner_id" INT,
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", "Maria", "Sharapova", "1987-04-19", "RUS");
INSERT INTO "players" VALUES ("4", "Simona", "Halep", "1991-09-27", "ROU");
INSERT INTO "players" VALUES ("5", "Naomi", "Osaka", "1997-10-16", "JPN");
INSERT INTO "players" VALUES ("6", "Ashleigh", "Barty", "1996-04-24", "AUS");
INSERT INTO "players" VALUES ("7", "Angelique", "Kerber", "1988-01-18", "GER");
INSERT INTO "players" VALUES ("8", "Victoria", "Azarenka", "1989-07-31", "BLR");
INSERT INTO "players" VALUES ("9", "Caroline", "Wozniacki", "1990-07-11", "DEN");
INSERT INTO "players" VALUES ("10", "Garbiñe", "Muguruza", "1993-10-08", "ESP");
INSERT INTO "players" VALUES ("11", "Petra", "Kvitova", "1999-03-08", "CZE");
INSERT INTO "players" VALUES ("12", "Sloane", "Stephens", "1993-03-20", "USA");
INSERT INTO "players" VALUES ("13", "Jelena", "Ostapenko", "1997-06-08", "LAT");
INSERT INTO "players" VALUES ("14", "Bianca", "Andreescu", "2000-06-16", "CAN");
INSERT INTO "players" VALUES ("15", "Iga", "Swiatek", "2001-05-31", "POL");
INSERT INTO "matches" VALUES ("2017-01-28", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2017-10-29", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2018-01-27", "Australian Open", "9");
INSERT INTO "matches" VALUES ("2018-10-28", "WTA Championships", "4");
INSERT INTO "matches" VALUES ("2019-01-26", "Australian Open", "5");
INSERT INTO "matches" VALUES ("2019-11-03", "WTA Championships", "6");
INSERT INTO "matches" VALUES ("2020-02-01", "Australian Open", "5");
INSERT INTO "matches" VALUES ("2021-02-20", "Australian Open", "5");
INSERT INTO "matches" VALUES ("2021-11-17", "WTA Championships", "10");
INSERT INTO "matches" VALUES ("2022-01-29", "Australian Open", "6");
INSERT INTO "matches" VALUES ("2022-11-07", "WTA Championships", "15");
INSERT INTO "matches" VALUES ("2016-01-30", "Australian Open", "7");
INSERT INTO "matches" VALUES ("2016-10-30", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2015-01-31", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2015-11-01", "WTA Championships", "3");
INSERT INTO "matches" VALUES ("2014-01-25", "Australian Open", "8");
INSERT INTO "matches" VALUES ("2014-10-26", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2013-01-26", "Australian Open", "8");
INSERT INTO "matches" VALUES ("2013-10-27", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2012-01-28", "Australian Open", "8");
INSERT INTO "matches" VALUES ("2012-10-28", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2011-01-29", "Australian Open", "3");
INSERT INTO "matches" VALUES ("2011-10-30", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2010-01-30", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2010-10-31", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2009-01-31", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2009-11-01", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2008-01-26", "Australian Open", "3");
INSERT INTO "matches" VALUES ("2008-11-09", "WTA Championships", "2");
INSERT INTO "matches" VALUES ("2007-01-27", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2007-11-11", "WTA Championships", "7");
INSERT INTO "matches" VALUES ("2006-01-28", "Australian Open", "7");
INSERT INTO "matches" VALUES ("2006-11-12", "WTA Championships", "3");
INSERT INTO "matches" VALUES ("2005-01-29", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2005-11-13", "WTA Championships", "3");
INSERT INTO "matches" VALUES ("2004-01-31", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2004-11-14", "WTA Championships", "1");
INSERT INTO "matches" VALUES ("2003-01-25", "Australian Open", "1");
INSERT INTO "matches" VALUES ("2003-11-09", "WTA Championships", "1");