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

CREATE TABLE "car_names" (
"MakeId" INT UNIQUE,
"Make" TEXT,
PRIMARY KEY ("MakeId")
);

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

CREATE TABLE "model_list" (
"ModelId" INT,
"Model" TEXT UNIQUE,
PRIMARY KEY ("ModelId")
);





INSERT INTO "car_makers" VALUES ("1", "Toyota", "Japan");
INSERT INTO "car_makers" VALUES ("2", "Ford", "USA");
INSERT INTO "car_makers" VALUES ("3", "Fiat", "Italy");
INSERT INTO "car_makers" VALUES ("4", "Hyundai", "South Korea");
INSERT INTO "car_makers" VALUES ("5", "Volkswagen", "Germany");
INSERT INTO "car_makers" VALUES ("6", "Tesla", "USA");
INSERT INTO "car_makers" VALUES ("7", "Renault", "France");
INSERT INTO "car_names" VALUES ("1", "Corolla");
INSERT INTO "car_names" VALUES ("2", "Mustang");
INSERT INTO "car_names" VALUES ("3", "500");
INSERT INTO "car_names" VALUES ("4", "Elantra");
INSERT INTO "car_names" VALUES ("5", "Golf");
INSERT INTO "car_names" VALUES ("6", "Model S");
INSERT INTO "car_names" VALUES ("7", "Clio");
INSERT INTO "cars_data" VALUES ("1", "4", "132");
INSERT INTO "cars_data" VALUES ("2", "8", "450");
INSERT INTO "cars_data" VALUES ("3", "2", "101");
INSERT INTO "cars_data" VALUES ("4", "4", "147");
INSERT INTO "cars_data" VALUES ("5", "4", "170");
INSERT INTO "cars_data" VALUES ("6", "0", "670");
INSERT INTO "cars_data" VALUES ("7", "3", "90");
INSERT INTO "model_list" VALUES ("1", "Sedan");
INSERT INTO "model_list" VALUES ("2", "Coupe");
INSERT INTO "model_list" VALUES ("3", "Hatchback");
INSERT INTO "model_list" VALUES ("4", "Sedan");
INSERT INTO "model_list" VALUES ("5", "Hatchback");
INSERT INTO "model_list" VALUES ("6", "Sedan");
INSERT INTO "model_list" VALUES ("7", "Hatchback");