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

CREATE TABLE "cars_data" (
"Id" INT,
"Horsepower" TEXT,
"Year" INT,
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", "BMW", "Germany");
INSERT INTO "car_makers" VALUES ("4", "Hyundai", "South Korea");
INSERT INTO "car_makers" VALUES ("5", "Fiat", "Italy");
INSERT INTO "car_makers" VALUES ("6", "Tesla", "USA");
INSERT INTO "car_makers" VALUES ("7", "Volvo", "Sweden");
INSERT INTO "car_makers" VALUES ("8", "Renault", "France");
INSERT INTO "model_list" VALUES ("1", "Corolla");
INSERT INTO "model_list" VALUES ("2", "Mustang");
INSERT INTO "model_list" VALUES ("3", "3 Series");
INSERT INTO "model_list" VALUES ("4", "Elantra");
INSERT INTO "model_list" VALUES ("5", "Panda");
INSERT INTO "model_list" VALUES ("6", "Model S");
INSERT INTO "model_list" VALUES ("7", "XC90");
INSERT INTO "model_list" VALUES ("8", "Clio");
INSERT INTO "model_list" VALUES ("9", "Camry");
INSERT INTO "model_list" VALUES ("10", "F-150");
INSERT INTO "model_list" VALUES ("11", "i8");
INSERT INTO "model_list" VALUES ("12", "Sonata");
INSERT INTO "model_list" VALUES ("13", "500");
INSERT INTO "model_list" VALUES ("14", "Model 3");
INSERT INTO "model_list" VALUES ("15", "V40");
INSERT INTO "model_list" VALUES ("16", "Megane");
INSERT INTO "car_names" VALUES ("1", "Corolla");
INSERT INTO "car_names" VALUES ("2", "Mustang");
INSERT INTO "car_names" VALUES ("3", "3 Series");
INSERT INTO "car_names" VALUES ("4", "Elantra");
INSERT INTO "car_names" VALUES ("5", "Panda");
INSERT INTO "car_names" VALUES ("6", "Model S");
INSERT INTO "car_names" VALUES ("7", "XC90");
INSERT INTO "car_names" VALUES ("8", "Clio");
INSERT INTO "car_names" VALUES ("9", "Camry");
INSERT INTO "car_names" VALUES ("10", "F-150");
INSERT INTO "car_names" VALUES ("11", "i8");
INSERT INTO "car_names" VALUES ("12", "Sonata");
INSERT INTO "car_names" VALUES ("13", "500");
INSERT INTO "car_names" VALUES ("14", "Model 3");
INSERT INTO "car_names" VALUES ("15", "V40");
INSERT INTO "car_names" VALUES ("16", "Megane");
INSERT INTO "cars_data" VALUES ("1", "132 hp", "1979");
INSERT INTO "cars_data" VALUES ("2", "450 hp", "1985");
INSERT INTO "cars_data" VALUES ("3", "180 hp", "1990");
INSERT INTO "cars_data" VALUES ("4", "147 hp", "1983");
INSERT INTO "cars_data" VALUES ("5", "55 hp", "1975");
INSERT INTO "cars_data" VALUES ("6", "670 hp", "2018");
INSERT INTO "cars_data" VALUES ("7", "316 hp", "2015");
INSERT INTO "cars_data" VALUES ("8", "90 hp", "1981");
INSERT INTO "cars_data" VALUES ("9", "203 hp", "1982");
INSERT INTO "cars_data" VALUES ("10", "290 hp", "1978");
INSERT INTO "cars_data" VALUES ("11", "369 hp", "2014");
INSERT INTO "cars_data" VALUES ("12", "191 hp", "1987");
INSERT INTO "cars_data" VALUES ("13", "23 hp", "1970");
INSERT INTO "cars_data" VALUES ("14", "283 hp", "2020");
INSERT INTO "cars_data" VALUES ("15", "187 hp", "1995");
INSERT INTO "cars_data" VALUES ("16", "115 hp", "1984");