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

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

CREATE TABLE "cars_data" (
"Id" INT,
PRIMARY KEY ("Id"),
FOREIGN KEY ("Id") REFERENCES "car_names"("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", "Toyota", "Toyota Motor Corporation");
INSERT INTO "car_makers" VALUES ("2", "Honda", "Honda Motor Co.");
INSERT INTO "car_makers" VALUES ("3", "Ford", "Ford Motor Company");
INSERT INTO "car_makers" VALUES ("4", "BMW", "Bayerische Motoren Werke AG");
INSERT INTO "car_makers" VALUES ("5", "Mercedes-Benz", "Mercedes-Benz Group AG");
INSERT INTO "car_makers" VALUES ("6", "Audi", "Audi AG");
INSERT INTO "car_makers" VALUES ("7", "Nissan", "Nissan Motor Corporation");
INSERT INTO "car_makers" VALUES ("8", "Hyundai", "Hyundai Motor Company");
INSERT INTO "car_makers" VALUES ("9", "Kia", "Kia Corporation");
INSERT INTO "car_makers" VALUES ("10", "Volkswagen", "Volkswagen AG");
INSERT INTO "model_list" VALUES ("101", "1", "Camry");
INSERT INTO "model_list" VALUES ("102", "1", "Corolla");
INSERT INTO "model_list" VALUES ("103", "1", "RAV4");
INSERT INTO "model_list" VALUES ("104", "1", "Highlander");
INSERT INTO "model_list" VALUES ("201", "2", "Civic");
INSERT INTO "model_list" VALUES ("202", "2", "Accord");
INSERT INTO "model_list" VALUES ("203", "2", "CR-V");
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", "5 Series");
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 ("101", "Camry");
INSERT INTO "car_names" VALUES ("102", "Corolla");
INSERT INTO "car_names" VALUES ("103", "RAV4");
INSERT INTO "car_names" VALUES ("104", "Highlander");
INSERT INTO "car_names" VALUES ("201", "Civic");
INSERT INTO "car_names" VALUES ("202", "Accord");
INSERT INTO "car_names" VALUES ("203", "CR-V");
INSERT INTO "car_names" VALUES ("301", "F-150");
INSERT INTO "car_names" VALUES ("302", "Mustang");
INSERT INTO "car_names" VALUES ("303", "Explorer");
INSERT INTO "car_names" VALUES ("401", "3 Series");
INSERT INTO "car_names" VALUES ("402", "5 Series");
INSERT INTO "car_names" VALUES ("501", "C-Class");
INSERT INTO "car_names" VALUES ("502", "E-Class");
INSERT INTO "car_names" VALUES ("601", "A4");
INSERT INTO "car_names" VALUES ("701", "Altima");
INSERT INTO "car_names" VALUES ("801", "Elantra");
INSERT INTO "car_names" VALUES ("901", "Sportage");
INSERT INTO "car_names" VALUES ("1001", "Golf");
INSERT INTO "car_names" VALUES ("1002", "Passat");
INSERT INTO "cars_data" VALUES ("101");
INSERT INTO "cars_data" VALUES ("102");
INSERT INTO "cars_data" VALUES ("103");
INSERT INTO "cars_data" VALUES ("104");
INSERT INTO "cars_data" VALUES ("201");
INSERT INTO "cars_data" VALUES ("202");
INSERT INTO "cars_data" VALUES ("203");
INSERT INTO "cars_data" VALUES ("301");
INSERT INTO "cars_data" VALUES ("302");
INSERT INTO "cars_data" VALUES ("303");
INSERT INTO "cars_data" VALUES ("401");
INSERT INTO "cars_data" VALUES ("402");
INSERT INTO "cars_data" VALUES ("501");
INSERT INTO "cars_data" VALUES ("502");
INSERT INTO "cars_data" VALUES ("601");
INSERT INTO "cars_data" VALUES ("701");
INSERT INTO "cars_data" VALUES ("801");
INSERT INTO "cars_data" VALUES ("901");
INSERT INTO "cars_data" VALUES ("1001");
INSERT INTO "cars_data" VALUES ("1002");