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,
"Edispl" FLOAT,
"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", "volvo");
INSERT INTO "car_makers" VALUES ("2", "Ford");
INSERT INTO "car_makers" VALUES ("3", "Toyota");
INSERT INTO "car_makers" VALUES ("4", "Honda");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Mercedes-Benz");
INSERT INTO "model_list" VALUES ("1", "Volvo 240");
INSERT INTO "model_list" VALUES ("2", "Volvo S60");
INSERT INTO "model_list" VALUES ("3", "Ford Focus");
INSERT INTO "model_list" VALUES ("4", "Toyota Camry");
INSERT INTO "model_list" VALUES ("5", "Honda Civic");
INSERT INTO "model_list" VALUES ("6", "BMW 3 Series");
INSERT INTO "model_list" VALUES ("7", "Mercedes C-Class");
INSERT INTO "model_list" VALUES ("8", "Volvo XC90");
INSERT INTO "model_list" VALUES ("9", "Volvo S90");
INSERT INTO "model_list" VALUES ("10", "Volvo V60");
INSERT INTO "car_names" VALUES ("1", "Volvo 240", "volvo");
INSERT INTO "car_names" VALUES ("2", "Volvo S60", "volvo");
INSERT INTO "car_names" VALUES ("3", "Ford Focus", "Ford");
INSERT INTO "car_names" VALUES ("4", "Toyota Camry", "Toyota");
INSERT INTO "car_names" VALUES ("5", "Honda Civic", "Honda");
INSERT INTO "car_names" VALUES ("6", "BMW 3 Series", "BMW");
INSERT INTO "car_names" VALUES ("7", "Mercedes C-Class", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("8", "Volvo XC90", "volvo");
INSERT INTO "car_names" VALUES ("9", "Volvo S90", "volvo");
INSERT INTO "car_names" VALUES ("10", "Volvo V60", "volvo");
INSERT INTO "car_names" VALUES ("11", "Ford Mustang", "Ford");
INSERT INTO "car_names" VALUES ("12", "Toyota Corolla", "Toyota");
INSERT INTO "cars_data" VALUES ("1", "2.3", "114");
INSERT INTO "cars_data" VALUES ("2", "2.0", "250");
INSERT INTO "cars_data" VALUES ("3", "2.0", "160");
INSERT INTO "cars_data" VALUES ("4", "2.5", "203");
INSERT INTO "cars_data" VALUES ("5", "1.8", "158");
INSERT INTO "cars_data" VALUES ("6", "3.0", "255");
INSERT INTO "cars_data" VALUES ("7", "2.0", "200");
INSERT INTO "cars_data" VALUES ("8", "2.0", "316");
INSERT INTO "cars_data" VALUES ("9", "2.0", "250");
INSERT INTO "cars_data" VALUES ("10", "2.0", "250");
INSERT INTO "cars_data" VALUES ("11", "5.0", "450");
INSERT INTO "cars_data" VALUES ("12", "1.8", "139");