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,
"Horsepower" TEXT,
"Year" INT,
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 "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", "3 Series");
INSERT INTO "model_list" VALUES ("6", "Supra");
INSERT INTO "model_list" VALUES ("7", "Accord");
INSERT INTO "model_list" VALUES ("8", "F-150");
INSERT INTO "model_list" VALUES ("9", "Impala");
INSERT INTO "car_names" VALUES ("1", "Corolla", "Toyota");
INSERT INTO "car_names" VALUES ("2", "Mustang", "Ford");
INSERT INTO "car_names" VALUES ("3", "Civic", "Honda");
INSERT INTO "car_names" VALUES ("4", "Camaro", "Chevrolet");
INSERT INTO "car_names" VALUES ("5", "3 Series", "BMW");
INSERT INTO "car_names" VALUES ("6", "Supra", "Toyota");
INSERT INTO "car_names" VALUES ("7", "Accord", "Honda");
INSERT INTO "car_names" VALUES ("8", "F-150", "Ford");
INSERT INTO "car_names" VALUES ("9", "Impala", "Chevrolet");
INSERT INTO "cars_data" VALUES ("1", "132 hp", "1979");
INSERT INTO "cars_data" VALUES ("2", "225 hp", "1985");
INSERT INTO "cars_data" VALUES ("3", "140 hp", "1990");
INSERT INTO "cars_data" VALUES ("4", "275 hp", "1975");
INSERT INTO "cars_data" VALUES ("5", "180 hp", "1983");
INSERT INTO "cars_data" VALUES ("6", "230 hp", "1998");
INSERT INTO "cars_data" VALUES ("7", "150 hp", "1981");
INSERT INTO "cars_data" VALUES ("8", "290 hp", "1978");
INSERT INTO "cars_data" VALUES ("9", "165 hp", "1987");