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

CREATE TABLE "death" (
"caused_by_ship_id" INT,
"id" 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,
"location" TEXT,
PRIMARY KEY ("id"),
FOREIGN KEY ("lost_in_battle") REFERENCES "battle"("id")
);





INSERT INTO "battle" VALUES ("1", "Battle of Thermopylae", "Leonidas", "Defeat");
INSERT INTO "battle" VALUES ("2", "Battle of Marathon", "Miltiades", "Victory");
INSERT INTO "battle" VALUES ("3", "Battle of Salamis", "Themistocles", "Victory");
INSERT INTO "battle" VALUES ("4", "Battle of Actium", "Mark Antony", "Defeat");
INSERT INTO "battle" VALUES ("5", "Battle of Trafalgar", "Pierre-Charles Villeneuve", "Defeat");
INSERT INTO "battle" VALUES ("6", "Battle of Jutland", "Reinhard Scheer", "Inconclusive");
INSERT INTO "battle" VALUES ("7", "Battle of the English Channel 1588", "Duke of Medina Sidonia", "Defeat");
INSERT INTO "battle" VALUES ("8", "Battle of the English Channel 1940", "Erich Raeder", "Victory");
INSERT INTO "battle" VALUES ("9", "Battle of Midway", "Isoroku Yamamoto", "Defeat");
INSERT INTO "battle" VALUES ("10", "Battle of Leyte Gulf", "Takeo Kurita", "Defeat");
INSERT INTO "death" VALUES ("101", "1");
INSERT INTO "death" VALUES ("102", "2");
INSERT INTO "death" VALUES ("103", "3");
INSERT INTO "death" VALUES ("104", "4");
INSERT INTO "death" VALUES ("105", "5");
INSERT INTO "death" VALUES ("106", "6");
INSERT INTO "death" VALUES ("107", "7");
INSERT INTO "death" VALUES ("108", "8");
INSERT INTO "death" VALUES ("109", "9");
INSERT INTO "death" VALUES ("110", "10");
INSERT INTO "ship" VALUES ("7", "101", "San Martin", "English Channel");
INSERT INTO "ship" VALUES ("7", "102", "San Juan", "English Channel");
INSERT INTO "ship" VALUES ("8", "103", "Bismarck", "English Channel");
INSERT INTO "ship" VALUES ("8", "104", "Hood", "English Channel");
INSERT INTO "ship" VALUES ("5", "105", "Victory", "Atlantic Ocean");
INSERT INTO "ship" VALUES ("5", "106", "Bucentaure", "Atlantic Ocean");
INSERT INTO "ship" VALUES ("6", "107", "SMS Lützow", "North Sea");
INSERT INTO "ship" VALUES ("6", "108", "HMS Invincible", "North Sea");
INSERT INTO "ship" VALUES ("9", "109", "Akagi", "Pacific Ocean");
INSERT INTO "ship" VALUES ("10", "110", "Musashi", "Pacific Ocean");
INSERT INTO "ship" VALUES ("1", "111", "Trireme", "Aegean Sea");
INSERT INTO "ship" VALUES ("2", "112", "Trireme", "Aegean Sea");
INSERT INTO "ship" VALUES ("3", "113", "Trireme", "Aegean Sea");
INSERT INTO "ship" VALUES ("4", "114", "Quinquereme", "Ionian Sea");