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 UNIQUE,
"name" TEXT,
"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", "Battle of Midway", "1942-06-04");
INSERT INTO "battle" VALUES ("2", "Battle of the Atlantic", "1939-09-01");
INSERT INTO "battle" VALUES ("3", "Battle of Trafalgar", "1805-10-21");
INSERT INTO "battle" VALUES ("4", "Battle of Jutland", "1916-05-31");
INSERT INTO "battle" VALUES ("5", "Battle of Leyte Gulf", "1944-10-23");
INSERT INTO "battle" VALUES ("6", "Battle of Tsushima", "1905-05-27");
INSERT INTO "battle" VALUES ("7", "Battle of Coronel", "1914-11-01");
INSERT INTO "battle" VALUES ("8", "Battle of River Plate", "1939-12-13");
INSERT INTO "ship" VALUES ("1", "101", "USS Yorktown");
INSERT INTO "ship" VALUES ("1", "102", "IJN Akagi");
INSERT INTO "ship" VALUES ("2", "201", "HMS Hood");
INSERT INTO "ship" VALUES ("2", "202", "Bismarck");
INSERT INTO "ship" VALUES ("3", "301", "HMS Victory");
INSERT INTO "ship" VALUES ("3", "302", "Bucentaure");
INSERT INTO "ship" VALUES ("4", "401", "HMS Invincible");
INSERT INTO "ship" VALUES ("4", "402", "SMS Lützow");
INSERT INTO "ship" VALUES ("5", "501", "USS Princeton");
INSERT INTO "ship" VALUES ("5", "502", "IJN Musashi");
INSERT INTO "ship" VALUES ("6", "601", "Knyaz Suvorov");
INSERT INTO "ship" VALUES ("7", "701", "HMS Good Hope");
INSERT INTO "ship" VALUES ("8", "801", "Admiral Graf Spee");
INSERT INTO "death" VALUES ("101", "1", "50", "100");
INSERT INTO "death" VALUES ("102", "2", "200", "50");
INSERT INTO "death" VALUES ("201", "3", "1415", "6");
INSERT INTO "death" VALUES ("202", "4", "115", "20");
INSERT INTO "death" VALUES ("301", "5", "57", "102");
INSERT INTO "death" VALUES ("302", "6", "19", "30");
INSERT INTO "death" VALUES ("401", "7", "1026", "25");
INSERT INTO "death" VALUES ("402", "8", "115", "15");
INSERT INTO "death" VALUES ("501", "9", "10", "5");
INSERT INTO "death" VALUES ("502", "10", "9", "2");
INSERT INTO "death" VALUES ("601", "11", "600", "100");
INSERT INTO "death" VALUES ("701", "12", "900", "0");
INSERT INTO "death" VALUES ("801", "13", "36", "50");
INSERT INTO "death" VALUES ("101", "14", "5", "10");
INSERT INTO "death" VALUES ("102", "15", "6", "12");
INSERT INTO "death" VALUES ("201", "16", "4", "8");
INSERT INTO "death" VALUES ("202", "17", "7", "14");
INSERT INTO "death" VALUES ("301", "18", "8", "16");
INSERT INTO "death" VALUES ("302", "19", "3", "6");
INSERT INTO "death" VALUES ("401", "20", "10", "20");
INSERT INTO "death" VALUES ("402", "21", "9", "18");