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,
"Accelerate" FLOAT,
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", "volvo");
INSERT INTO "car_makers" VALUES ("2", "Ford");
INSERT INTO "car_makers" VALUES ("3", "Chevrolet");
INSERT INTO "car_makers" VALUES ("4", "Toyota");
INSERT INTO "car_makers" VALUES ("5", "Honda");
INSERT INTO "car_makers" VALUES ("6", "BMW");
INSERT INTO "model_list" VALUES ("1", "240");
INSERT INTO "model_list" VALUES ("2", "740");
INSERT INTO "model_list" VALUES ("3", "940");
INSERT INTO "model_list" VALUES ("4", "S60");
INSERT INTO "model_list" VALUES ("5", "V70");
INSERT INTO "model_list" VALUES ("6", "Mustang");
INSERT INTO "model_list" VALUES ("7", "F-150");
INSERT INTO "model_list" VALUES ("8", "Camaro");
INSERT INTO "model_list" VALUES ("9", "Corolla");
INSERT INTO "model_list" VALUES ("10", "Civic");
INSERT INTO "car_names" VALUES ("1", "240", "volvo");
INSERT INTO "car_names" VALUES ("2", "740", "volvo");
INSERT INTO "car_names" VALUES ("3", "940", "volvo");
INSERT INTO "car_names" VALUES ("4", "S60", "volvo");
INSERT INTO "car_names" VALUES ("5", "V70", "volvo");
INSERT INTO "car_names" VALUES ("6", "Mustang", "Ford");
INSERT INTO "car_names" VALUES ("7", "F-150", "Ford");
INSERT INTO "car_names" VALUES ("8", "Camaro", "Chevrolet");
INSERT INTO "car_names" VALUES ("9", "Corolla", "Toyota");
INSERT INTO "car_names" VALUES ("10", "Civic", "Honda");
INSERT INTO "cars_data" VALUES ("1", "4", "100", "18.0");
INSERT INTO "cars_data" VALUES ("2", "4", "110", "17.5");
INSERT INTO "cars_data" VALUES ("3", "4", "115", "16.0");
INSERT INTO "cars_data" VALUES ("4", "5", "170", "15.0");
INSERT INTO "cars_data" VALUES ("5", "5", "190", "14.5");
INSERT INTO "cars_data" VALUES ("6", "8", "300", "6.0");
INSERT INTO "cars_data" VALUES ("7", "6", "250", "8.0");
INSERT INTO "cars_data" VALUES ("8", "8", "400", "5.0");
INSERT INTO "cars_data" VALUES ("9", "4", "130", "10.0");
INSERT INTO "cars_data" VALUES ("10", "4", "120", "9.0");
INSERT INTO "cars_data" VALUES ("11", "4", "90", "20.0");
INSERT INTO "cars_data" VALUES ("12", "4", "95", "19.5");
INSERT INTO "cars_data" VALUES ("13", "4", "105", "18.5");
INSERT INTO "cars_data" VALUES ("14", "5", "160", "15.5");
INSERT INTO "cars_data" VALUES ("15", "5", "180", "14.0");