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,
"Horsepower" TEXT,
"Weight" INT,
"Year" INT,
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", "Chevrolet");
INSERT INTO "car_makers" VALUES ("4", "Honda");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Tesla");
INSERT INTO "car_makers" VALUES ("7", "Jeep");
INSERT INTO "car_makers" VALUES ("8", "Subaru");
INSERT INTO "car_names" VALUES ("1", "Corolla");
INSERT INTO "car_names" VALUES ("2", "F-150");
INSERT INTO "car_names" VALUES ("3", "Camaro");
INSERT INTO "car_names" VALUES ("4", "Civic");
INSERT INTO "car_names" VALUES ("5", "X5");
INSERT INTO "car_names" VALUES ("6", "Model S");
INSERT INTO "car_names" VALUES ("7", "Wrangler");
INSERT INTO "car_names" VALUES ("8", "Impreza");
INSERT INTO "cars_data" VALUES ("1", "132 hp", "2800", "2018");
INSERT INTO "cars_data" VALUES ("2", "450 hp", "4500", "2018");
INSERT INTO "cars_data" VALUES ("3", "275 hp", "3600", "2019");
INSERT INTO "cars_data" VALUES ("4", "158 hp", "2700", "2019");
INSERT INTO "cars_data" VALUES ("5", "335 hp", "4800", "2020");
INSERT INTO "cars_data" VALUES ("6", "670 hp", "4900", "2020");
INSERT INTO "cars_data" VALUES ("7", "285 hp", "4200", "2021");
INSERT INTO "cars_data" VALUES ("8", "152 hp", "3100", "2021");
INSERT INTO "cars_data" VALUES ("9", "200 hp", "3900", "2022");
INSERT INTO "cars_data" VALUES ("10", "310 hp", "3200", "2022");