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

CREATE TABLE "players" (
"player_id" INT UNIQUE,
"hand" TEXT,
PRIMARY KEY ("player_id")
);





INSERT INTO "players" VALUES ("1", "L");
INSERT INTO "players" VALUES ("2", "R");
INSERT INTO "players" VALUES ("3", "L");
INSERT INTO "players" VALUES ("4", "R");
INSERT INTO "players" VALUES ("5", "L");
INSERT INTO "players" VALUES ("6", "R");
INSERT INTO "players" VALUES ("7", "L");
INSERT INTO "players" VALUES ("8", "R");
INSERT INTO "matches" VALUES ("R", "WTA Championships", "WTA Championships", "L", "1", "Player A");
INSERT INTO "matches" VALUES ("L", "WTA Championships", "WTA Championships", "L", "3", "Player C");
INSERT INTO "matches" VALUES ("R", "WTA Championships", "WTA Championships", "R", "4", "Player D");
INSERT INTO "matches" VALUES ("L", "WTA Championships", "WTA Championships", "L", "5", "Player E");
INSERT INTO "matches" VALUES ("R", "WTA 1000", "WTA 1000", "L", "7", "Player G");
INSERT INTO "matches" VALUES ("L", "WTA Championships", "WTA Championships", "R", "6", "Player F");
INSERT INTO "matches" VALUES ("R", "WTA 500", "WTA 500", "L", "1", "Player A");
INSERT INTO "matches" VALUES ("L", "WTA Championships", "WTA Championships", "L", "7", "Player G");
INSERT INTO "matches" VALUES ("R", "WTA Championships", "WTA Championships", "R", "8", "Player H");
INSERT INTO "matches" VALUES ("L", "WTA 250", "WTA 250", "L", "3", "Player C");