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,
PRIMARY KEY ("MakeId")
);

CREATE TABLE "cars_data" (
"Id" INT,
"MPG" TEXT,
"Cylinders" INT,
"Horsepower" TEXT,
"Year" INT,
PRIMARY KEY ("Id"),
FOREIGN KEY ("Id") REFERENCES "car_names"("MakeId")
);





INSERT INTO "car_makers" VALUES ("1", "Ford");
INSERT INTO "car_makers" VALUES ("2", "Chevrolet");
INSERT INTO "car_makers" VALUES ("3", "Dodge");
INSERT INTO "car_makers" VALUES ("4", "Toyota");
INSERT INTO "car_makers" VALUES ("5", "Honda");
INSERT INTO "car_makers" VALUES ("6", "BMW");
INSERT INTO "car_makers" VALUES ("7", "Mercedes");
INSERT INTO "car_makers" VALUES ("8", "Volkswagen");
INSERT INTO "car_makers" VALUES ("9", "Porsche");
INSERT INTO "car_makers" VALUES ("10", "Tesla");
INSERT INTO "car_names" VALUES ("1", "Mustang");
INSERT INTO "car_names" VALUES ("2", "Camaro");
INSERT INTO "car_names" VALUES ("3", "Charger");
INSERT INTO "car_names" VALUES ("4", "Corolla");
INSERT INTO "car_names" VALUES ("5", "Civic");
INSERT INTO "car_names" VALUES ("6", "3 Series");
INSERT INTO "car_names" VALUES ("7", "C-Class");
INSERT INTO "car_names" VALUES ("8", "Golf");
INSERT INTO "car_names" VALUES ("9", "911");
INSERT INTO "car_names" VALUES ("10", "Model S");
INSERT INTO "cars_data" VALUES ("1", "18", "8", "300", "1978");
INSERT INTO "cars_data" VALUES ("2", "15", "8", "350", "1975");
INSERT INTO "cars_data" VALUES ("3", "14", "8", "370", "1982");
INSERT INTO "cars_data" VALUES ("4", "30", "4", "110", "1979");
INSERT INTO "cars_data" VALUES ("5", "32", "4", "105", "1985");
INSERT INTO "cars_data" VALUES ("6", "25", "6", "200", "1980");
INSERT INTO "cars_data" VALUES ("7", "22", "6", "220", "1977");
INSERT INTO "cars_data" VALUES ("8", "28", "4", "130", "1983");
INSERT INTO "cars_data" VALUES ("9", "20", "6", "250", "1976");
INSERT INTO "cars_data" VALUES ("10", "102", "0", "670", "2020");