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", "Toyota");
INSERT INTO "car_makers" VALUES ("4", "Dodge");
INSERT INTO "car_makers" VALUES ("5", "Honda");
INSERT INTO "car_makers" VALUES ("6", "BMW");
INSERT INTO "car_makers" VALUES ("7", "Volkswagen");
INSERT INTO "car_makers" VALUES ("8", "Mercedes");
INSERT INTO "car_makers" VALUES ("9", "Audi");
INSERT INTO "car_makers" VALUES ("10", "Subaru");
INSERT INTO "car_names" VALUES ("1", "Mustang");
INSERT INTO "car_names" VALUES ("2", "Camaro");
INSERT INTO "car_names" VALUES ("3", "Corolla");
INSERT INTO "car_names" VALUES ("4", "Charger");
INSERT INTO "car_names" VALUES ("5", "Civic");
INSERT INTO "car_names" VALUES ("6", "3 Series");
INSERT INTO "car_names" VALUES ("7", "Golf");
INSERT INTO "car_names" VALUES ("8", "C-Class");
INSERT INTO "car_names" VALUES ("9", "A4");
INSERT INTO "car_names" VALUES ("10", "Impreza");
INSERT INTO "cars_data" VALUES ("1", "18", "8", "210", "1978");
INSERT INTO "cars_data" VALUES ("2", "15", "8", "230", "1975");
INSERT INTO "cars_data" VALUES ("3", "35", "4", "90", "1985");
INSERT INTO "cars_data" VALUES ("4", "12", "8", "300", "1979");
INSERT INTO "cars_data" VALUES ("5", "40", "4", "100", "1982");
INSERT INTO "cars_data" VALUES ("6", "25", "6", "180", "1980");
INSERT INTO "cars_data" VALUES ("7", "30", "4", "110", "1990");
INSERT INTO "cars_data" VALUES ("8", "22", "6", "170", "1977");
INSERT INTO "cars_data" VALUES ("9", "28", "4", "150", "1983");
INSERT INTO "cars_data" VALUES ("10", "27", "4", "140", "1976");