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", "Chevrolet");
INSERT INTO "car_makers" VALUES ("4", "Dodge");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Honda");
INSERT INTO "car_makers" VALUES ("7", "Tesla");
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 "cars_data" VALUES ("1", "4", "130");
INSERT INTO "cars_data" VALUES ("2", "8", "400");
INSERT INTO "cars_data" VALUES ("3", "6", "355");
INSERT INTO "cars_data" VALUES ("4", "10", "450");
INSERT INTO "cars_data" VALUES ("5", "4", "180");
INSERT INTO "cars_data" VALUES ("6", "3", "140");
INSERT INTO "cars_data" VALUES ("7", "0", "Electric");
INSERT INTO "model_list" VALUES ("1", "Corolla");
INSERT INTO "model_list" VALUES ("2", "Mustang");
INSERT INTO "model_list" VALUES ("3", "Camaro");
INSERT INTO "model_list" VALUES ("4", "Charger");
INSERT INTO "model_list" VALUES ("5", "320i");
INSERT INTO "model_list" VALUES ("6", "Civic");
INSERT INTO "model_list" VALUES ("7", "Model S");