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,
"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", "Ford");
INSERT INTO "car_makers" VALUES ("2", "Chevrolet");
INSERT INTO "car_makers" VALUES ("3", "Honda");
INSERT INTO "car_makers" VALUES ("4", "Toyota");
INSERT INTO "car_makers" VALUES ("5", "BMW");
INSERT INTO "car_makers" VALUES ("6", "Mercedes-Benz");
INSERT INTO "car_makers" VALUES ("7", "Audi");
INSERT INTO "car_makers" VALUES ("8", "Nissan");
INSERT INTO "car_makers" VALUES ("9", "Hyundai");
INSERT INTO "car_makers" VALUES ("10", "Kia");
INSERT INTO "car_names" VALUES ("1", "Ford");
INSERT INTO "car_names" VALUES ("2", "Chevrolet");
INSERT INTO "car_names" VALUES ("3", "Honda");
INSERT INTO "car_names" VALUES ("4", "Toyota");
INSERT INTO "car_names" VALUES ("5", "BMW");
INSERT INTO "car_names" VALUES ("6", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("7", "Audi");
INSERT INTO "car_names" VALUES ("8", "Nissan");
INSERT INTO "car_names" VALUES ("9", "Hyundai");
INSERT INTO "car_names" VALUES ("10", "Kia");
INSERT INTO "cars_data" VALUES ("1", "1965");
INSERT INTO "cars_data" VALUES ("2", "1965");
INSERT INTO "cars_data" VALUES ("3", "1970");
INSERT INTO "cars_data" VALUES ("4", "1972");
INSERT INTO "cars_data" VALUES ("5", "1980");
INSERT INTO "cars_data" VALUES ("6", "1985");
INSERT INTO "cars_data" VALUES ("7", "1990");
INSERT INTO "cars_data" VALUES ("8", "1995");
INSERT INTO "cars_data" VALUES ("9", "2000");
INSERT INTO "cars_data" VALUES ("10", "2005");
INSERT INTO "model_list" VALUES ("1", "1", "Mustang");
INSERT INTO "model_list" VALUES ("2", "2", "Corvette");
INSERT INTO "model_list" VALUES ("3", "3", "Civic");
INSERT INTO "model_list" VALUES ("4", "4", "Camry");
INSERT INTO "model_list" VALUES ("5", "5", "3 Series");
INSERT INTO "model_list" VALUES ("6", "6", "C-Class");
INSERT INTO "model_list" VALUES ("7", "7", "A4");
INSERT INTO "model_list" VALUES ("8", "8", "Altima");
INSERT INTO "model_list" VALUES ("9", "9", "Elantra");
INSERT INTO "model_list" VALUES ("10", "10", "Optima");
INSERT INTO "model_list" VALUES ("11", "1", "F-150");
INSERT INTO "model_list" VALUES ("12", "2", "Silverado");
INSERT INTO "model_list" VALUES ("13", "3", "CR-V");
INSERT INTO "model_list" VALUES ("14", "4", "RAV4");
INSERT INTO "model_list" VALUES ("15", "5", "X5");
INSERT INTO "model_list" VALUES ("16", "6", "E-Class");
INSERT INTO "model_list" VALUES ("17", "7", "Q5");
INSERT INTO "model_list" VALUES ("18", "8", "Titan");
INSERT INTO "model_list" VALUES ("19", "9", "Sonata");
INSERT INTO "model_list" VALUES ("20", "10", "Sorento");