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,
"Model" 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", "Honda", "Honda Motor Co.", "Japan");
INSERT INTO "car_makers" VALUES ("2", "Toyota", "Toyota Motor Corporation", "Japan");
INSERT INTO "car_makers" VALUES ("3", "Ford", "Ford Motor Company", "USA");
INSERT INTO "car_makers" VALUES ("4", "BMW", "Bayerische Motoren Werke AG", "Germany");
INSERT INTO "car_makers" VALUES ("5", "Mercedes-Benz", "Mercedes-Benz Group AG", "Germany");
INSERT INTO "car_makers" VALUES ("6", "Audi", "Audi AG", "Germany");
INSERT INTO "car_makers" VALUES ("7", "Nissan", "Nissan Motor Corporation", "Japan");
INSERT INTO "car_makers" VALUES ("8", "Hyundai", "Hyundai Motor Company", "South Korea");
INSERT INTO "car_makers" VALUES ("9", "Kia", "Kia Corporation", "South Korea");
INSERT INTO "car_makers" VALUES ("10", "Volkswagen", "Volkswagen AG", "Germany");
INSERT INTO "model_list" VALUES ("101", "1", "Civic");
INSERT INTO "model_list" VALUES ("102", "1", "CR-V");
INSERT INTO "model_list" VALUES ("103", "1", "Accord");
INSERT INTO "model_list" VALUES ("201", "2", "Camry");
INSERT INTO "model_list" VALUES ("202", "2", "Corolla");
INSERT INTO "model_list" VALUES ("203", "2", "RAV4");
INSERT INTO "model_list" VALUES ("301", "3", "F-150");
INSERT INTO "model_list" VALUES ("302", "3", "Mustang");
INSERT INTO "model_list" VALUES ("303", "3", "Explorer");
INSERT INTO "model_list" VALUES ("401", "4", "3 Series");
INSERT INTO "model_list" VALUES ("402", "4", "X5");
INSERT INTO "model_list" VALUES ("501", "5", "C-Class");
INSERT INTO "model_list" VALUES ("502", "5", "E-Class");
INSERT INTO "model_list" VALUES ("601", "6", "A4");
INSERT INTO "model_list" VALUES ("701", "7", "Altima");
INSERT INTO "model_list" VALUES ("801", "8", "Elantra");
INSERT INTO "model_list" VALUES ("901", "9", "Sportage");
INSERT INTO "model_list" VALUES ("1001", "10", "Golf");
INSERT INTO "model_list" VALUES ("1002", "10", "Passat");
INSERT INTO "car_names" VALUES ("1", "Civic");
INSERT INTO "car_names" VALUES ("2", "CR-V");
INSERT INTO "car_names" VALUES ("3", "Accord");
INSERT INTO "car_names" VALUES ("4", "Camry");
INSERT INTO "car_names" VALUES ("5", "Corolla");
INSERT INTO "car_names" VALUES ("6", "RAV4");
INSERT INTO "car_names" VALUES ("7", "F-150");
INSERT INTO "car_names" VALUES ("8", "Mustang");
INSERT INTO "car_names" VALUES ("9", "Explorer");
INSERT INTO "car_names" VALUES ("10", "3 Series");
INSERT INTO "car_names" VALUES ("11", "X5");
INSERT INTO "car_names" VALUES ("12", "C-Class");
INSERT INTO "car_names" VALUES ("13", "E-Class");
INSERT INTO "car_names" VALUES ("14", "A4");
INSERT INTO "car_names" VALUES ("15", "Altima");
INSERT INTO "car_names" VALUES ("16", "Elantra");
INSERT INTO "car_names" VALUES ("17", "Sportage");
INSERT INTO "car_names" VALUES ("18", "Golf");
INSERT INTO "car_names" VALUES ("19", "Passat");