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 "car_makers" (
"Id" INT UNIQUE,
"Maker" TEXT,
"FullName" TEXT,
"Country" TEXT,
PRIMARY KEY ("Id")
);

CREATE TABLE "car_names" (
"MakeId" INT,
"Make" TEXT,
PRIMARY KEY ("MakeId")
);

CREATE TABLE "model_list" (
"ModelId" INT,
"Maker" INT,
"Model" TEXT UNIQUE,
PRIMARY KEY ("ModelId"),
FOREIGN KEY ("Maker") REFERENCES "car_makers"("Id")
);





INSERT INTO "car_makers" VALUES ("1", "AMC", "American Motor Company", "USA");
INSERT INTO "car_makers" VALUES ("2", "BMW", "Bayerische Motoren Werke AG", "Germany");
INSERT INTO "car_makers" VALUES ("3", "Toyota", "Toyota Motor Corporation", "Japan");
INSERT INTO "car_makers" VALUES ("4", "Ford", "Ford Motor Company", "USA");
INSERT INTO "car_makers" VALUES ("5", "Tesla", "Tesla, Inc.", "USA");
INSERT INTO "car_makers" VALUES ("6", "Fiat", "Fabbrica Italiana Automobili Torino", "Italy");
INSERT INTO "car_names" VALUES ("1", "AMC");
INSERT INTO "car_names" VALUES ("2", "BMW");
INSERT INTO "car_names" VALUES ("3", "Toyota");
INSERT INTO "car_names" VALUES ("4", "Ford");
INSERT INTO "car_names" VALUES ("5", "Tesla");
INSERT INTO "car_names" VALUES ("6", "Fiat");
INSERT INTO "model_list" VALUES ("101", "1", "Gremlin");
INSERT INTO "model_list" VALUES ("102", "1", "Pacer");
INSERT INTO "model_list" VALUES ("103", "1", "Javelin");
INSERT INTO "model_list" VALUES ("104", "1", "Hornet");
INSERT INTO "model_list" VALUES ("105", "1", "Matador");
INSERT INTO "model_list" VALUES ("201", "2", "X5");
INSERT INTO "model_list" VALUES ("202", "2", "M3");
INSERT INTO "model_list" VALUES ("203", "2", "i8");
INSERT INTO "model_list" VALUES ("301", "3", "Corolla");
INSERT INTO "model_list" VALUES ("302", "3", "Camry");
INSERT INTO "model_list" VALUES ("303", "3", "Prius");
INSERT INTO "model_list" VALUES ("401", "4", "Mustang");
INSERT INTO "model_list" VALUES ("402", "4", "F-150");
INSERT INTO "model_list" VALUES ("403", "4", "Explorer");
INSERT INTO "model_list" VALUES ("501", "5", "Model S");
INSERT INTO "model_list" VALUES ("502", "5", "Model 3");
INSERT INTO "model_list" VALUES ("503", "5", "Model X");
INSERT INTO "model_list" VALUES ("601", "6", "500");
INSERT INTO "model_list" VALUES ("602", "6", "Panda");
INSERT INTO "model_list" VALUES ("603", "6", "Tipo");