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

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





INSERT INTO "players" VALUES ("1", "R");
INSERT INTO "players" VALUES ("2", "L");
INSERT INTO "players" VALUES ("3", "R");
INSERT INTO "players" VALUES ("4", "L");
INSERT INTO "players" VALUES ("5", "A");
INSERT INTO "players" VALUES ("6", "R");
INSERT INTO "players" VALUES ("7", "A");
INSERT INTO "players" VALUES ("8", "L");
INSERT INTO "players" VALUES ("9", "R");
INSERT INTO "players" VALUES ("10", "A");
INSERT INTO "matches" VALUES ("L", "1", "R");
INSERT INTO "matches" VALUES ("R", "2", "L");
INSERT INTO "matches" VALUES ("A", "3", "R");
INSERT INTO "matches" VALUES ("R", "4", "A");
INSERT INTO "matches" VALUES ("L", "5", "A");
INSERT INTO "matches" VALUES ("A", "6", "L");
INSERT INTO "matches" VALUES ("R", "7", "A");
INSERT INTO "matches" VALUES ("L", "8", "R");
INSERT INTO "matches" VALUES ("A", "9", "L");
INSERT INTO "matches" VALUES ("R", "10", "A");