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 Trafalgar", "Admiral Nelson", "Victory");
INSERT INTO "battle" VALUES ("2", "Battle of the Nile", "Napoleon Bonaparte", "Defeat");
INSERT INTO "battle" VALUES ("3", "Battle of Jutland", "Admiral Jellicoe", "Inconclusive");
INSERT INTO "battle" VALUES ("4", "Battle of the English Channel 1", "Sir Francis Drake", "Victory");
INSERT INTO "battle" VALUES ("5", "Battle of the English Channel 2", "Lord Howard", "Victory");
INSERT INTO "battle" VALUES ("6", "Battle of the English Channel 3", "Admiral Blake", "Victory");
INSERT INTO "battle" VALUES ("7", "Battle of the English Channel 4", "Admiral Benbow", "Defeat");
INSERT INTO "battle" VALUES ("8", "Battle of the English Channel 5", "Admiral Byng", "Inconclusive");
INSERT INTO "battle" VALUES ("9", "Battle of the English Channel 6", "Admiral Rodney", "Victory");
INSERT INTO "battle" VALUES ("10", "Battle of the English Channel 7", "Admiral Hood", "Victory");
INSERT INTO "ship" VALUES ("1", "101", "HMS Victory", "Atlantic Ocean");
INSERT INTO "ship" VALUES ("1", "102", "HMS Temeraire", "Atlantic Ocean");
INSERT INTO "ship" VALUES ("2", "201", "L'Orient", "Mediterranean Sea");
INSERT INTO "ship" VALUES ("3", "301", "HMS Iron Duke", "North Sea");
INSERT INTO "ship" VALUES ("3", "302", "SMS Lützow", "North Sea");
INSERT INTO "ship" VALUES ("4", "401", "Golden Hind", "English Channel");
INSERT INTO "ship" VALUES ("5", "501", "Revenge", "English Channel");
INSERT INTO "ship" VALUES ("6", "601", "Sovereign of the Seas", "English Channel");
INSERT INTO "ship" VALUES ("7", "701", "HMS Prince George", "English Channel");
INSERT INTO "ship" VALUES ("7", "702", "HMS Royal Oak", "English Channel");
INSERT INTO "ship" VALUES ("8", "801", "HMS Monarch", "English Channel");
INSERT INTO "ship" VALUES ("9", "901", "HMS Formidable", "English Channel");
INSERT INTO "ship" VALUES ("9", "902", "HMS Barfleur", "English Channel");
INSERT INTO "ship" VALUES ("9", "903", "HMS Invincible", "English Channel");
INSERT INTO "ship" VALUES ("10", "1001", "HMS Victory 1737", "English Channel");
INSERT INTO "death" VALUES ("102", "1");
INSERT INTO "death" VALUES ("201", "2");
INSERT INTO "death" VALUES ("302", "3");
INSERT INTO "death" VALUES ("701", "4");
INSERT INTO "death" VALUES ("702", "5");
INSERT INTO "death" VALUES ("901", "6");
INSERT INTO "death" VALUES ("902", "7");
INSERT INTO "death" VALUES ("903", "8");