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

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

CREATE TABLE "cars_data" (
"Id" INT,
"Cylinders" INT,
"Horsepower" TEXT,
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", "Ford");
INSERT INTO "car_makers" VALUES ("2", "Chevrolet");
INSERT INTO "car_makers" VALUES ("3", "Honda");
INSERT INTO "car_makers" VALUES ("4", "Toyota");
INSERT INTO "car_makers" VALUES ("5", "Volkswagen");
INSERT INTO "car_makers" VALUES ("6", "Nissan");
INSERT INTO "car_makers" VALUES ("7", "BMW");
INSERT INTO "car_makers" VALUES ("8", "Mercedes-Benz");
INSERT INTO "car_makers" VALUES ("9", "Audi");
INSERT INTO "car_makers" VALUES ("10", "Hyundai");
INSERT INTO "model_list" VALUES ("101", "1", "F-150");
INSERT INTO "model_list" VALUES ("102", "1", "Mustang");
INSERT INTO "model_list" VALUES ("103", "2", "Silverado");
INSERT INTO "model_list" VALUES ("104", "2", "Corvette");
INSERT INTO "model_list" VALUES ("105", "3", "Civic");
INSERT INTO "model_list" VALUES ("106", "3", "CR-V");
INSERT INTO "model_list" VALUES ("107", "4", "Camry");
INSERT INTO "model_list" VALUES ("108", "4", "RAV4");
INSERT INTO "model_list" VALUES ("109", "5", "Golf");
INSERT INTO "model_list" VALUES ("110", "5", "Jetta");
INSERT INTO "model_list" VALUES ("111", "6", "Altima");
INSERT INTO "model_list" VALUES ("112", "6", "Rogue");
INSERT INTO "model_list" VALUES ("113", "7", "3 Series");
INSERT INTO "model_list" VALUES ("114", "7", "X5");
INSERT INTO "model_list" VALUES ("115", "8", "C-Class");
INSERT INTO "model_list" VALUES ("116", "8", "E-Class");
INSERT INTO "model_list" VALUES ("117", "9", "A4");
INSERT INTO "model_list" VALUES ("118", "9", "Q5");
INSERT INTO "model_list" VALUES ("119", "10", "Elantra");
INSERT INTO "model_list" VALUES ("120", "10", "Tucson");
INSERT INTO "car_names" VALUES ("1", "F-150", "Ford");
INSERT INTO "car_names" VALUES ("2", "Mustang", "Ford");
INSERT INTO "car_names" VALUES ("3", "Silverado", "Chevrolet");
INSERT INTO "car_names" VALUES ("4", "Corvette", "Chevrolet");
INSERT INTO "car_names" VALUES ("5", "Civic", "Honda");
INSERT INTO "car_names" VALUES ("6", "CR-V", "Honda");
INSERT INTO "car_names" VALUES ("7", "Camry", "Toyota");
INSERT INTO "car_names" VALUES ("8", "RAV4", "Toyota");
INSERT INTO "car_names" VALUES ("9", "Golf", "Volkswagen");
INSERT INTO "car_names" VALUES ("10", "Jetta", "Volkswagen");
INSERT INTO "car_names" VALUES ("11", "Altima", "Nissan");
INSERT INTO "car_names" VALUES ("12", "Rogue", "Nissan");
INSERT INTO "car_names" VALUES ("13", "3 Series", "BMW");
INSERT INTO "car_names" VALUES ("14", "X5", "BMW");
INSERT INTO "car_names" VALUES ("15", "C-Class", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("16", "E-Class", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("17", "A4", "Audi");
INSERT INTO "car_names" VALUES ("18", "Q5", "Audi");
INSERT INTO "car_names" VALUES ("19", "Elantra", "Hyundai");
INSERT INTO "car_names" VALUES ("20", "Tucson", "Hyundai");
INSERT INTO "cars_data" VALUES ("1", "8", "395");
INSERT INTO "cars_data" VALUES ("2", "8", "450");
INSERT INTO "cars_data" VALUES ("3", "8", "420");
INSERT INTO "cars_data" VALUES ("4", "8", "490");
INSERT INTO "cars_data" VALUES ("5", "4", "158");
INSERT INTO "cars_data" VALUES ("6", "4", "190");
INSERT INTO "cars_data" VALUES ("7", "4", "203");
INSERT INTO "cars_data" VALUES ("8", "4", "203");
INSERT INTO "cars_data" VALUES ("9", "4", "147");
INSERT INTO "cars_data" VALUES ("10", "4", "158");
INSERT INTO "cars_data" VALUES ("11", "4", "188");
INSERT INTO "cars_data" VALUES ("12", "4", "181");
INSERT INTO "cars_data" VALUES ("13", "6", "255");
INSERT INTO "cars_data" VALUES ("14", "6", "335");
INSERT INTO "cars_data" VALUES ("15", "4", "255");
INSERT INTO "cars_data" VALUES ("16", "6", "362");
INSERT INTO "cars_data" VALUES ("17", "4", "201");
INSERT INTO "cars_data" VALUES ("18", "4", "201");
INSERT INTO "cars_data" VALUES ("19", "4", "147");
INSERT INTO "cars_data" VALUES ("20", "4", "187");
INSERT INTO "cars_data" VALUES ("21", "3", "100");
INSERT INTO "cars_data" VALUES ("22", "3", "110");
INSERT INTO "cars_data" VALUES ("23", "3", "95");
INSERT INTO "cars_data" VALUES ("24", "3", "105");
INSERT INTO "cars_data" VALUES ("25", "4", "120");
INSERT INTO "cars_data" VALUES ("26", "4", "130");
INSERT INTO "cars_data" VALUES ("27", "4", "140");
INSERT INTO "cars_data" VALUES ("28", "4", "150");
INSERT INTO "cars_data" VALUES ("29", "4", "160");
INSERT INTO "cars_data" VALUES ("30", "4", "170");