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

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

CREATE TABLE "ship" (
"lost_in_battle" INT,
"id" INT UNIQUE,
"name" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("lost_in_battle") REFERENCES "battle"("id")
);





INSERT INTO "battle" VALUES ("1", "1942-06-04");
INSERT INTO "battle" VALUES ("2", "1943-11-28");
INSERT INTO "battle" VALUES ("3", "1944-07-24");
INSERT INTO "battle" VALUES ("4", "1945-02-19");
INSERT INTO "battle" VALUES ("5", "1941-12-07");
INSERT INTO "ship" VALUES ("1", "101", "USS Enterprise");
INSERT INTO "ship" VALUES ("2", "102", "HMS Hood");
INSERT INTO "ship" VALUES ("3", "3", "Bismarck");
INSERT INTO "ship" VALUES ("0", "104", "Yamato");
INSERT INTO "ship" VALUES ("5", "105", "USS Arizona");
INSERT INTO "ship" VALUES ("0", "106", "KMS Scharnhorst");
INSERT INTO "death" VALUES ("101", "201", "150", "300");
INSERT INTO "death" VALUES ("102", "202", "200", "400");
INSERT INTO "death" VALUES ("3", "203", "100", "250");
INSERT INTO "death" VALUES ("104", "204", "50", "0");
INSERT INTO "death" VALUES ("105", "205", "1200", "1500");
INSERT INTO "death" VALUES ("106", "206", "0", "0");
INSERT INTO "death" VALUES ("101", "207", "30", "70");
INSERT INTO "death" VALUES ("102", "208", "0", "10");
INSERT INTO "death" VALUES ("3", "209", "5", "15");
INSERT INTO "death" VALUES ("105", "210", "300", "500");