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,
PRIMARY KEY ("MakeId"),
FOREIGN KEY ("Model") REFERENCES "model_list"("Model")
);

CREATE TABLE "cars_data" (
"Id" INT,
"MPG" TEXT,
"Cylinders" INT,
"Horsepower" TEXT,
PRIMARY KEY ("Id"),
FOREIGN KEY ("Id") REFERENCES "car_names"("MakeId")
);

CREATE TABLE "model_list" (
"ModelId" INT,
"Model" TEXT UNIQUE,
PRIMARY KEY ("ModelId")
);





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", "Fiesta");
INSERT INTO "model_list" VALUES ("102", "Focus");
INSERT INTO "model_list" VALUES ("103", "Mustang");
INSERT INTO "model_list" VALUES ("201", "Malibu");
INSERT INTO "model_list" VALUES ("202", "Camaro");
INSERT INTO "model_list" VALUES ("301", "Civic");
INSERT INTO "model_list" VALUES ("302", "Accord");
INSERT INTO "model_list" VALUES ("401", "Corolla");
INSERT INTO "model_list" VALUES ("402", "Camry");
INSERT INTO "model_list" VALUES ("501", "Golf");
INSERT INTO "model_list" VALUES ("502", "Jetta");
INSERT INTO "model_list" VALUES ("601", "Sentra");
INSERT INTO "model_list" VALUES ("701", "3 Series");
INSERT INTO "model_list" VALUES ("801", "C-Class");
INSERT INTO "model_list" VALUES ("901", "A4");
INSERT INTO "model_list" VALUES ("1001", "Elantra");
INSERT INTO "model_list" VALUES ("1002", "Accent");
INSERT INTO "model_list" VALUES ("1003", "Pinto");
INSERT INTO "model_list" VALUES ("1004", "Rabbit");
INSERT INTO "car_names" VALUES ("1", "Fiesta");
INSERT INTO "car_names" VALUES ("2", "Malibu");
INSERT INTO "car_names" VALUES ("3", "Civic");
INSERT INTO "car_names" VALUES ("4", "Corolla");
INSERT INTO "car_names" VALUES ("5", "Golf");
INSERT INTO "car_names" VALUES ("6", "Sentra");
INSERT INTO "car_names" VALUES ("7", "3 Series");
INSERT INTO "car_names" VALUES ("8", "C-Class");
INSERT INTO "car_names" VALUES ("9", "A4");
INSERT INTO "car_names" VALUES ("10", "Elantra");
INSERT INTO "car_names" VALUES ("11", "Pinto");
INSERT INTO "car_names" VALUES ("12", "Rabbit");
INSERT INTO "car_names" VALUES ("13", "Accent");
INSERT INTO "cars_data" VALUES ("1", "30.0", "4", "75");
INSERT INTO "cars_data" VALUES ("2", "25.0", "6", "110");
INSERT INTO "cars_data" VALUES ("3", "35.0", "4", "80");
INSERT INTO "cars_data" VALUES ("4", "32.0", "4", "75");
INSERT INTO "cars_data" VALUES ("5", "28.0", "4", "90");
INSERT INTO "cars_data" VALUES ("6", "29.0", "4", "85");
INSERT INTO "cars_data" VALUES ("7", "20.0", "6", "180");
INSERT INTO "cars_data" VALUES ("8", "18.0", "8", "220");
INSERT INTO "cars_data" VALUES ("9", "22.0", "6", "190");
INSERT INTO "cars_data" VALUES ("10", "27.0", "4", "100");
INSERT INTO "cars_data" VALUES ("11", "26.0", "4", "70");
INSERT INTO "cars_data" VALUES ("12", "24.0", "4", "70");
INSERT INTO "cars_data" VALUES ("13", "31.0", "4", "78");