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 "battle" (
"id" INT,
"name" TEXT,
PRIMARY KEY ("id")
);

CREATE TABLE "death" (
"caused_by_ship_id" INT,
"id" INT,
PRIMARY KEY ("id"),
FOREIGN KEY ("caused_by_ship_id") REFERENCES "ship"("id")
);

CREATE TABLE "ship" (
"id" INT UNIQUE,
"disposition_of_ship" TEXT,
PRIMARY KEY ("id")
);





INSERT INTO "battle" VALUES ("1", "Battle of Trafalgar");
INSERT INTO "battle" VALUES ("2", "Battle of Midway");
INSERT INTO "battle" VALUES ("3", "Battle of Jutland");
INSERT INTO "battle" VALUES ("4", "Battle of Leyte Gulf");
INSERT INTO "battle" VALUES ("5", "Battle of the Coral Sea");
INSERT INTO "ship" VALUES ("101", "Captured");
INSERT INTO "ship" VALUES ("102", "Sunk");
INSERT INTO "ship" VALUES ("103", "Captured");
INSERT INTO "ship" VALUES ("104", "Damaged");
INSERT INTO "ship" VALUES ("105", "Captured");
INSERT INTO "ship" VALUES ("106", "Sunk");
INSERT INTO "ship" VALUES ("107", "Captured");
INSERT INTO "ship" VALUES ("108", "Operational");
INSERT INTO "ship" VALUES ("109", "Captured");
INSERT INTO "ship" VALUES ("110", "Sunk");
INSERT INTO "death" VALUES ("101", "201");
INSERT INTO "death" VALUES ("102", "202");
INSERT INTO "death" VALUES ("103", "203");
INSERT INTO "death" VALUES ("106", "204");
INSERT INTO "death" VALUES ("107", "205");
INSERT INTO "death" VALUES ("110", "206");
INSERT INTO "death" VALUES ("109", "207");
INSERT INTO "death" VALUES ("105", "208");