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

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





INSERT INTO "players" VALUES ("1", "Serena", "Williams", "USA");
INSERT INTO "players" VALUES ("2", "Maria", "Sharapova", "RUS");
INSERT INTO "players" VALUES ("3", "Simona", "Halep", "ROU");
INSERT INTO "players" VALUES ("4", "Angelique", "Kerber", "GER");
INSERT INTO "players" VALUES ("5", "Victoria", "Azarenka", "BLR");
INSERT INTO "players" VALUES ("6", "Petra", "Kvitova", "CZE");
INSERT INTO "players" VALUES ("7", "Caroline", "Wozniacki", "DEN");
INSERT INTO "players" VALUES ("8", "Garbiñe", "Muguruza", "ESP");
INSERT INTO "players" VALUES ("9", "Agnieszka", "Radwanska", "POL");
INSERT INTO "players" VALUES ("10", "Sloane", "Stephens", "USA");
INSERT INTO "matches" VALUES ("2013-01-15", "1", "Serena Williams", "2013");
INSERT INTO "matches" VALUES ("2013-03-20", "2", "Maria Sharapova", "2013");
INSERT INTO "matches" VALUES ("2013-05-10", "3", "Simona Halep", "2013");
INSERT INTO "matches" VALUES ("2013-07-05", "4", "Angelique Kerber", "2013");
INSERT INTO "matches" VALUES ("2013-08-22", "5", "Victoria Azarenka", "2013");
INSERT INTO "matches" VALUES ("2013-09-30", "6", "Petra Kvitova", "2013");
INSERT INTO "matches" VALUES ("2013-11-12", "7", "Caroline Wozniacki", "2013");
INSERT INTO "matches" VALUES ("2016-02-14", "1", "Serena Williams", "2016");
INSERT INTO "matches" VALUES ("2016-04-18", "3", "Simona Halep", "2016");
INSERT INTO "matches" VALUES ("2016-06-25", "8", "Garbiñe Muguruza", "2016");
INSERT INTO "matches" VALUES ("2016-07-30", "9", "Agnieszka Radwanska", "2016");
INSERT INTO "matches" VALUES ("2016-09-15", "10", "Sloane Stephens", "2016");
INSERT INTO "matches" VALUES ("2016-10-20", "4", "Angelique Kerber", "2016");
INSERT INTO "matches" VALUES ("2016-11-28", "5", "Victoria Azarenka", "2016");
INSERT INTO "matches" VALUES ("2013-12-01", "10", "Sloane Stephens", "2013");
INSERT INTO "matches" VALUES ("2016-12-05", "2", "Maria Sharapova", "2016");
INSERT INTO "matches" VALUES ("2013-08-15", "8", "Garbiñe Muguruza", "2013");
INSERT INTO "matches" VALUES ("2016-03-10", "6", "Petra Kvitova", "2016");
INSERT INTO "matches" VALUES ("2013-10-22", "9", "Agnieszka Radwanska", "2013");
INSERT INTO "matches" VALUES ("2016-05-18", "7", "Caroline Wozniacki", "2016");