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

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

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

CREATE TABLE "model_list" (
"ModelId" INT,
"Maker" INT,
"Model" TEXT UNIQUE,
PRIMARY KEY ("ModelId"),
FOREIGN KEY ("Maker") REFERENCES "car_makers"("Id")
);





INSERT INTO "car_makers" VALUES ("1", "Toyota");
INSERT INTO "car_makers" VALUES ("2", "Honda");
INSERT INTO "car_makers" VALUES ("3", "Ford");
INSERT INTO "car_makers" VALUES ("4", "BMW");
INSERT INTO "car_makers" VALUES ("5", "Mercedes-Benz");
INSERT INTO "car_makers" VALUES ("6", "Audi");
INSERT INTO "car_makers" VALUES ("7", "Nissan");
INSERT INTO "car_makers" VALUES ("8", "Hyundai");
INSERT INTO "car_makers" VALUES ("9", "Kia");
INSERT INTO "car_makers" VALUES ("10", "Chevrolet");
INSERT INTO "car_names" VALUES ("1", "Toyota");
INSERT INTO "car_names" VALUES ("2", "Honda");
INSERT INTO "car_names" VALUES ("3", "Ford");
INSERT INTO "car_names" VALUES ("4", "BMW");
INSERT INTO "car_names" VALUES ("5", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("6", "Audi");
INSERT INTO "car_names" VALUES ("7", "Nissan");
INSERT INTO "car_names" VALUES ("8", "Hyundai");
INSERT INTO "car_names" VALUES ("9", "Kia");
INSERT INTO "car_names" VALUES ("10", "Chevrolet");
INSERT INTO "cars_data" VALUES ("1", "2022");
INSERT INTO "cars_data" VALUES ("2", "2023");
INSERT INTO "cars_data" VALUES ("3", "2021");
INSERT INTO "cars_data" VALUES ("4", "2023");
INSERT INTO "cars_data" VALUES ("5", "2022");
INSERT INTO "cars_data" VALUES ("6", "2023");
INSERT INTO "cars_data" VALUES ("7", "2021");
INSERT INTO "cars_data" VALUES ("8", "2022");
INSERT INTO "cars_data" VALUES ("9", "2023");
INSERT INTO "cars_data" VALUES ("10", "2021");
INSERT INTO "model_list" VALUES ("101", "1", "Camry");
INSERT INTO "model_list" VALUES ("102", "1", "Corolla");
INSERT INTO "model_list" VALUES ("103", "2", "Civic");
INSERT INTO "model_list" VALUES ("104", "2", "Accord");
INSERT INTO "model_list" VALUES ("105", "3", "F-150");
INSERT INTO "model_list" VALUES ("106", "3", "Mustang");
INSERT INTO "model_list" VALUES ("107", "4", "X5");
INSERT INTO "model_list" VALUES ("108", "4", "3 Series");
INSERT INTO "model_list" VALUES ("109", "5", "C-Class");
INSERT INTO "model_list" VALUES ("110", "5", "E-Class");
INSERT INTO "model_list" VALUES ("111", "6", "A4");
INSERT INTO "model_list" VALUES ("112", "6", "Q5");
INSERT INTO "model_list" VALUES ("113", "7", "Altima");
INSERT INTO "model_list" VALUES ("114", "7", "Rogue");
INSERT INTO "model_list" VALUES ("115", "8", "Elantra");
INSERT INTO "model_list" VALUES ("116", "8", "Tucson");
INSERT INTO "model_list" VALUES ("117", "9", "Sportage");
INSERT INTO "model_list" VALUES ("118", "9", "Telluride");
INSERT INTO "model_list" VALUES ("119", "10", "Silverado");
INSERT INTO "model_list" VALUES ("120", "10", "Malibu");
INSERT INTO "model_list" VALUES ("121", "1", "RAV4");
INSERT INTO "model_list" VALUES ("122", "2", "CR-V");
INSERT INTO "model_list" VALUES ("123", "3", "Explorer");
INSERT INTO "model_list" VALUES ("124", "4", "5 Series");
INSERT INTO "model_list" VALUES ("125", "5", "GLC");
INSERT INTO "model_list" VALUES ("126", "6", "A6");
INSERT INTO "model_list" VALUES ("127", "7", "Titan");
INSERT INTO "model_list" VALUES ("128", "8", "Sonata");
INSERT INTO "model_list" VALUES ("129", "9", "Sorento");
INSERT INTO "model_list" VALUES ("130", "10", "Tahoe");