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 the Philippine Sea", "1944-06-19");
INSERT INTO "battle" VALUES ("8", "Battle of the Coral Sea", "1942-05-04");
INSERT INTO "ship" VALUES ("1", "101", "USS Yorktown");
INSERT INTO "ship" VALUES ("1", "102", "IJN Akagi");
INSERT INTO "ship" VALUES ("2", "103", "HMS Hood");
INSERT INTO "ship" VALUES ("2", "104", "Bismarck");
INSERT INTO "ship" VALUES ("3", "105", "HMS Victory");
INSERT INTO "ship" VALUES ("3", "106", "Bucentaure");
INSERT INTO "ship" VALUES ("4", "107", "HMS Lion");
INSERT INTO "ship" VALUES ("4", "108", "SMS Lützow");
INSERT INTO "ship" VALUES ("5", "109", "USS Princeton");
INSERT INTO "ship" VALUES ("5", "110", "IJN Musashi");
INSERT INTO "ship" VALUES ("6", "111", "Knyaz Suvorov");
INSERT INTO "ship" VALUES ("7", "112", "USS Lexington");
INSERT INTO "ship" VALUES ("8", "113", "USS Lexington CV-2");
INSERT INTO "death" VALUES ("101", "1", "50", "100");
INSERT INTO "death" VALUES ("102", "2", "200", "50");
INSERT INTO "death" VALUES ("103", "3", "1415", "6");
INSERT INTO "death" VALUES ("104", "4", "2200", "115");
INSERT INTO "death" VALUES ("105", "5", "57", "102");
INSERT INTO "death" VALUES ("106", "6", "644", "439");
INSERT INTO "death" VALUES ("107", "7", "100", "200");
INSERT INTO "death" VALUES ("108", "8", "500", "300");
INSERT INTO "death" VALUES ("109", "9", "600", "400");
INSERT INTO "death" VALUES ("110", "10", "1000", "500");
INSERT INTO "death" VALUES ("111", "11", "800", "200");
INSERT INTO "death" VALUES ("112", "12", "216", "295");
INSERT INTO "death" VALUES ("113", "13", "216", "295");