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

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

CREATE TABLE "ship" (
"lost_in_battle" INT,
"id" INT,
"tonnage" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("lost_in_battle") REFERENCES "battle"("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 Coral Sea");
INSERT INTO "battle" VALUES ("6", "Battle of the Atlantic");
INSERT INTO "battle" VALUES ("7", "Battle of Guadalcanal");
INSERT INTO "battle" VALUES ("8", "Battle of the Philippine Sea");
INSERT INTO "ship" VALUES ("1", "101", "225");
INSERT INTO "ship" VALUES ("1", "102", "300");
INSERT INTO "ship" VALUES ("2", "103", "225");
INSERT INTO "ship" VALUES ("2", "104", "400");
INSERT INTO "ship" VALUES ("3", "105", "150");
INSERT INTO "ship" VALUES ("3", "106", "225");
INSERT INTO "ship" VALUES ("4", "107", "500");
INSERT INTO "ship" VALUES ("5", "108", "225");
INSERT INTO "ship" VALUES ("6", "109", "600");
INSERT INTO "ship" VALUES ("7", "110", "225");
INSERT INTO "ship" VALUES ("8", "111", "700");
INSERT INTO "death" VALUES ("101", "201", "50");
INSERT INTO "death" VALUES ("102", "202", "30");
INSERT INTO "death" VALUES ("103", "203", "40");
INSERT INTO "death" VALUES ("104", "204", "20");
INSERT INTO "death" VALUES ("105", "205", "10");
INSERT INTO "death" VALUES ("107", "206", "60");
INSERT INTO "death" VALUES ("108", "207", "25");
INSERT INTO "death" VALUES ("109", "208", "15");
INSERT INTO "death" VALUES ("110", "209", "35");
INSERT INTO "death" VALUES ("111", "210", "45");