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

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,
"Model" TEXT UNIQUE,
PRIMARY KEY ("ModelId")
);





INSERT INTO "car_makers" VALUES ("1", "Toyota");
INSERT INTO "car_makers" VALUES ("2", "Ford");
INSERT INTO "car_makers" VALUES ("3", "Honda");
INSERT INTO "car_makers" VALUES ("4", "Chevrolet");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Tesla");
INSERT INTO "car_makers" VALUES ("7", "Dodge");
INSERT INTO "car_makers" VALUES ("8", "Volkswagen");
INSERT INTO "car_makers" VALUES ("9", "Nissan");
INSERT INTO "car_makers" VALUES ("10", "Subaru");
INSERT INTO "car_names" VALUES ("1");
INSERT INTO "car_names" VALUES ("2");
INSERT INTO "car_names" VALUES ("3");
INSERT INTO "car_names" VALUES ("4");
INSERT INTO "car_names" VALUES ("5");
INSERT INTO "car_names" VALUES ("6");
INSERT INTO "car_names" VALUES ("7");
INSERT INTO "car_names" VALUES ("8");
INSERT INTO "car_names" VALUES ("9");
INSERT INTO "car_names" VALUES ("10");
INSERT INTO "cars_data" VALUES ("1", "4", "130");
INSERT INTO "cars_data" VALUES ("2", "6", "250");
INSERT INTO "cars_data" VALUES ("3", "4", "140");
INSERT INTO "cars_data" VALUES ("4", "8", "350");
INSERT INTO "cars_data" VALUES ("5", "6", "300");
INSERT INTO "cars_data" VALUES ("6", "0", "Electric");
INSERT INTO "cars_data" VALUES ("7", "8", "450");
INSERT INTO "cars_data" VALUES ("8", "4", "180");
INSERT INTO "cars_data" VALUES ("9", "4", "160");
INSERT INTO "cars_data" VALUES ("10", "4", "170");
INSERT INTO "model_list" VALUES ("1", "Corolla");
INSERT INTO "model_list" VALUES ("2", "Mustang");
INSERT INTO "model_list" VALUES ("3", "Civic");
INSERT INTO "model_list" VALUES ("4", "Camaro");
INSERT INTO "model_list" VALUES ("5", "M3");
INSERT INTO "model_list" VALUES ("6", "Model S");
INSERT INTO "model_list" VALUES ("7", "Charger");
INSERT INTO "model_list" VALUES ("8", "Golf");
INSERT INTO "model_list" VALUES ("9", "Altima");
INSERT INTO "model_list" VALUES ("10", "Impreza");