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





INSERT INTO "car_makers" VALUES ("1", "Toyota");
INSERT INTO "car_makers" VALUES ("2", "Ford");
INSERT INTO "car_makers" VALUES ("3", "Honda");
INSERT INTO "car_makers" VALUES ("4", "Chevrolet");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Volkswagen");
INSERT INTO "car_makers" VALUES ("7", "Mazda");
INSERT INTO "car_makers" VALUES ("8", "Subaru");
INSERT INTO "car_makers" VALUES ("9", "Nissan");
INSERT INTO "car_makers" VALUES ("10", "Hyundai");
INSERT INTO "car_names" VALUES ("1", "Corolla");
INSERT INTO "car_names" VALUES ("2", "Mustang");
INSERT INTO "car_names" VALUES ("3", "Civic");
INSERT INTO "car_names" VALUES ("4", "Impala");
INSERT INTO "car_names" VALUES ("5", "320i");
INSERT INTO "car_names" VALUES ("6", "Golf");
INSERT INTO "car_names" VALUES ("7", "MX-5");
INSERT INTO "car_names" VALUES ("8", "Outback");
INSERT INTO "car_names" VALUES ("9", "Altima");
INSERT INTO "car_names" VALUES ("10", "Elantra");
INSERT INTO "cars_data" VALUES ("1", "30", "4", "132");
INSERT INTO "cars_data" VALUES ("2", "22", "8", "450");
INSERT INTO "cars_data" VALUES ("3", "32", "4", "158");
INSERT INTO "cars_data" VALUES ("4", "18", "6", "305");
INSERT INTO "cars_data" VALUES ("5", "28", "4", "180");
INSERT INTO "cars_data" VALUES ("6", "27", "4", "170");
INSERT INTO "cars_data" VALUES ("7", "26", "4", "155");
INSERT INTO "cars_data" VALUES ("8", "24", "6", "260");
INSERT INTO "cars_data" VALUES ("9", "31", "4", "188");
INSERT INTO "cars_data" VALUES ("10", "29", "4", "147");