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,
"FullName" TEXT,
PRIMARY KEY ("Id")
);

CREATE TABLE "car_names" (
"MakeId" INT,
"Model" TEXT,
"Make" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY ("Model") REFERENCES "model_list"("Model")
);

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", "American Motor Company");
INSERT INTO "car_makers" VALUES ("2", "Ford Motor Company");
INSERT INTO "car_makers" VALUES ("3", "General Motors");
INSERT INTO "car_makers" VALUES ("4", "Toyota Motor Corporation");
INSERT INTO "car_makers" VALUES ("5", "Honda Motor Co.");
INSERT INTO "car_makers" VALUES ("6", "Volkswagen AG");
INSERT INTO "model_list" VALUES ("101", "1", "AMC Gremlin");
INSERT INTO "model_list" VALUES ("102", "1", "AMC Javelin");
INSERT INTO "model_list" VALUES ("103", "1", "AMC Pacer");
INSERT INTO "model_list" VALUES ("104", "2", "Ford F-150");
INSERT INTO "model_list" VALUES ("105", "2", "Ford Mustang");
INSERT INTO "model_list" VALUES ("106", "3", "Chevrolet Silverado");
INSERT INTO "model_list" VALUES ("107", "3", "Cadillac Escalade");
INSERT INTO "model_list" VALUES ("108", "4", "Toyota Camry");
INSERT INTO "model_list" VALUES ("109", "4", "Toyota Corolla");
INSERT INTO "model_list" VALUES ("110", "5", "Honda Civic");
INSERT INTO "model_list" VALUES ("111", "5", "Honda CR-V");
INSERT INTO "model_list" VALUES ("112", "6", "VW Golf");
INSERT INTO "model_list" VALUES ("113", "1", "AMC Eagle");
INSERT INTO "model_list" VALUES ("114", "2", "Ford Explorer");
INSERT INTO "car_names" VALUES ("1", "AMC Gremlin", "AMC");
INSERT INTO "car_names" VALUES ("2", "AMC Javelin", "AMC");
INSERT INTO "car_names" VALUES ("3", "AMC Pacer", "AMC");
INSERT INTO "car_names" VALUES ("4", "Ford F-150", "Ford");
INSERT INTO "car_names" VALUES ("5", "Ford Mustang", "Ford");
INSERT INTO "car_names" VALUES ("6", "Chevrolet Silverado", "Chevrolet");
INSERT INTO "car_names" VALUES ("7", "Cadillac Escalade", "Cadillac");
INSERT INTO "car_names" VALUES ("8", "Toyota Camry", "Toyota");
INSERT INTO "car_names" VALUES ("9", "Toyota Corolla", "Toyota");
INSERT INTO "car_names" VALUES ("10", "Honda Civic", "Honda");
INSERT INTO "car_names" VALUES ("11", "Honda CR-V", "Honda");
INSERT INTO "car_names" VALUES ("12", "VW Golf", "Volkswagen");
INSERT INTO "car_names" VALUES ("13", "AMC Eagle", "AMC");
INSERT INTO "car_names" VALUES ("14", "Ford Explorer", "Ford");