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,
"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,
"ship_type" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("lost_in_battle") REFERENCES "battle"("id")
);





INSERT INTO "battle" VALUES ("1", "Battle of Midway");
INSERT INTO "battle" VALUES ("2", "Battle of the Atlantic");
INSERT INTO "battle" VALUES ("3", "Battle of Leyte Gulf");
INSERT INTO "battle" VALUES ("4", "Battle of Jutland");
INSERT INTO "battle" VALUES ("5", "Battle of Tsushima");
INSERT INTO "ship" VALUES ("1", "101", "USS Enterprise", "Aircraft Carrier");
INSERT INTO "ship" VALUES ("1", "102", "IJN Akagi", "Aircraft Carrier");
INSERT INTO "ship" VALUES ("2", "103", "U-96", "Submarine");
INSERT INTO "ship" VALUES ("2", "104", "HMS Hood", "Battlecruiser");
INSERT INTO "ship" VALUES ("3", "105", "USS Missouri", "Battleship");
INSERT INTO "ship" VALUES ("3", "106", "IJN Musashi", "Battleship");
INSERT INTO "ship" VALUES ("4", "107", "SMS Seydlitz", "Battlecruiser");
INSERT INTO "ship" VALUES ("4", "108", "HMS Lion", "Battlecruiser");
INSERT INTO "ship" VALUES ("5", "109", "Knyaz Suvorov", "Battleship");
INSERT INTO "ship" VALUES ("5", "110", "Mikasa", "Battleship");
INSERT INTO "ship" VALUES ("NULL", "111", "USS Arizona", "Battleship");
INSERT INTO "ship" VALUES ("NULL", "112", "Bismarck", "Battleship");
INSERT INTO "death" VALUES ("101", "1", "50");
INSERT INTO "death" VALUES ("102", "2", "150");
INSERT INTO "death" VALUES ("103", "3", "200");
INSERT INTO "death" VALUES ("103", "4", "100");
INSERT INTO "death" VALUES ("104", "5", "120");
INSERT INTO "death" VALUES ("105", "6", "30");
INSERT INTO "death" VALUES ("106", "7", "400");
INSERT INTO "death" VALUES ("106", "8", "50");
INSERT INTO "death" VALUES ("107", "9", "80");
INSERT INTO "death" VALUES ("108", "10", "70");
INSERT INTO "death" VALUES ("109", "11", "250");
INSERT INTO "death" VALUES ("109", "12", "100");
INSERT INTO "death" VALUES ("110", "13", "60");
INSERT INTO "death" VALUES ("111", "14", "1177");
INSERT INTO "death" VALUES ("112", "15", "2200");