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", "Ford");
INSERT INTO "car_makers" VALUES ("2", "Chevrolet");
INSERT INTO "car_makers" VALUES ("3", "volvo");
INSERT INTO "car_makers" VALUES ("4", "Honda");
INSERT INTO "car_makers" VALUES ("5", "Toyota");
INSERT INTO "model_list" VALUES ("1", "Mustang");
INSERT INTO "model_list" VALUES ("2", "Camaro");
INSERT INTO "model_list" VALUES ("3", "240");
INSERT INTO "model_list" VALUES ("4", "Civic");
INSERT INTO "model_list" VALUES ("5", "Corolla");
INSERT INTO "model_list" VALUES ("6", "S60");
INSERT INTO "model_list" VALUES ("7", "XC90");
INSERT INTO "car_names" VALUES ("101", "Mustang", "Ford");
INSERT INTO "car_names" VALUES ("102", "Camaro", "Chevrolet");
INSERT INTO "car_names" VALUES ("103", "240", "volvo");
INSERT INTO "car_names" VALUES ("104", "Civic", "Honda");
INSERT INTO "car_names" VALUES ("105", "Corolla", "Toyota");
INSERT INTO "car_names" VALUES ("106", "S60", "volvo");
INSERT INTO "car_names" VALUES ("107", "XC90", "volvo");
INSERT INTO "cars_data" VALUES ("101", "8", "300hp", "7.5");
INSERT INTO "cars_data" VALUES ("102", "6", "250hp", "6.8");
INSERT INTO "cars_data" VALUES ("103", "4", "110hp", "18.0");
INSERT INTO "cars_data" VALUES ("104", "4", "150hp", "8.2");
INSERT INTO "cars_data" VALUES ("105", "4", "130hp", "9.0");
INSERT INTO "cars_data" VALUES ("106", "5", "200hp", "7.0");
INSERT INTO "cars_data" VALUES ("107", "4", "180hp", "7.0");