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,
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 Trafalgar", "1805-10-21");
INSERT INTO "battle" VALUES ("2", "Battle of the Nile", "1798-08-01");
INSERT INTO "battle" VALUES ("3", "Battle of Copenhagen", "1801-04-02");
INSERT INTO "battle" VALUES ("4", "Battle of Cape St. Vincent", "1797-02-14");
INSERT INTO "battle" VALUES ("5", "Battle of Camperdown", "1797-10-11");
INSERT INTO "battle" VALUES ("6", "Battle of Navarino", "1827-10-20");
INSERT INTO "battle" VALUES ("7", "Battle of Lissa", "1811-03-13");
INSERT INTO "battle" VALUES ("8", "Battle of Grand Port", "1810-08-23");
INSERT INTO "ship" VALUES ("1", "101", "HMS Victory", "Ship of the Line");
INSERT INTO "ship" VALUES ("1", "102", "Redoutable", "Ship of the Line");
INSERT INTO "ship" VALUES ("2", "201", "Orient", "Ship of the Line");
INSERT INTO "ship" VALUES ("3", "301", "HMS Elephant", "Ship of the Line");
INSERT INTO "ship" VALUES ("4", "401", "San Josef", "Ship of the Line");
INSERT INTO "ship" VALUES ("5", "501", "Vrijheid", "Ship of the Line");
INSERT INTO "ship" VALUES ("6", "601", "Syracuse", "Brig");
INSERT INTO "ship" VALUES ("6", "602", "Alcyone", "Frigate");
INSERT INTO "ship" VALUES ("7", "701", "Corona", "Frigate");
INSERT INTO "ship" VALUES ("8", "801", "Iphigenia", "Frigate");
INSERT INTO "ship" VALUES ("1", "103", "HMS Pickle", "Schooner");
INSERT INTO "ship" VALUES ("2", "202", "Leander", "Brig");
INSERT INTO "ship" VALUES ("3", "302", "Glatton", "Brig");
INSERT INTO "ship" VALUES ("4", "402", "Minerve", "Brig");
INSERT INTO "ship" VALUES ("5", "502", "Jupiter", "Brig");
INSERT INTO "ship" VALUES ("6", "603", "Scorpion", "Brig");
INSERT INTO "ship" VALUES ("7", "702", "Bellona", "Brig");
INSERT INTO "ship" VALUES ("8", "802", "Nereide", "Brig");
INSERT INTO "death" VALUES ("102", "1");
INSERT INTO "death" VALUES ("201", "2");
INSERT INTO "death" VALUES ("601", "3");
INSERT INTO "death" VALUES ("202", "4");
INSERT INTO "death" VALUES ("302", "5");
INSERT INTO "death" VALUES ("402", "6");
INSERT INTO "death" VALUES ("502", "7");
INSERT INTO "death" VALUES ("603", "8");
INSERT INTO "death" VALUES ("702", "9");
INSERT INTO "death" VALUES ("802", "10");