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

CREATE TABLE "cars_data" (
"Id" INT,
"Cylinders" INT,
"Horsepower" TEXT,
"Weight" INT,
"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", "Pontiac");
INSERT INTO "car_makers" VALUES ("5", "Buick");
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", "Firebird");
INSERT INTO "car_names" VALUES ("5", "Gran Sport");
INSERT INTO "cars_data" VALUES ("1", "8", "210", "3500", "1974");
INSERT INTO "cars_data" VALUES ("2", "8", "220", "3600", "1974");
INSERT INTO "cars_data" VALUES ("3", "6", "180", "3200", "1974");
INSERT INTO "cars_data" VALUES ("4", "8", "230", "3400", "1974");
INSERT INTO "cars_data" VALUES ("5", "8", "200", "3300", "1974");
INSERT INTO "cars_data" VALUES ("1", "8", "215", "3550", "1975");
INSERT INTO "cars_data" VALUES ("2", "6", "175", "3100", "1974");
INSERT INTO "cars_data" VALUES ("3", "8", "225", "3700", "1973");
INSERT INTO "cars_data" VALUES ("4", "4", "150", "2800", "1974");
INSERT INTO "cars_data" VALUES ("5", "8", "205", "3250", "1974");