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

CREATE TABLE "car_names" (
"MakeId" INT,
"Model" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY ("Model") REFERENCES "model_list"("Model")
);

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 Motor Corporation", "Japan");
INSERT INTO "car_makers" VALUES ("2", "Ford Motor Company", "United States");
INSERT INTO "car_makers" VALUES ("3", "Volkswagen AG", "Germany");
INSERT INTO "car_makers" VALUES ("4", "Hyundai Motor Company", "South Korea");
INSERT INTO "car_makers" VALUES ("5", "Tesla, Inc.", "United States");
INSERT INTO "car_makers" VALUES ("6", "Ferrari N.V.", "Italy");
INSERT INTO "car_makers" VALUES ("7", "Volvo Car Corporation", "Sweden");
INSERT INTO "car_makers" VALUES ("8", "Aston Martin Lagonda", "United Kingdom");
INSERT INTO "car_makers" VALUES ("9", "Maserati S.p.A.", "Italy");
INSERT INTO "car_makers" VALUES ("10", "Rivian Automotive", "United States");
INSERT INTO "model_list" VALUES ("101", "1", "Corolla");
INSERT INTO "model_list" VALUES ("102", "1", "Camry");
INSERT INTO "model_list" VALUES ("103", "1", "Prius");
INSERT INTO "model_list" VALUES ("104", "1", "RAV4");
INSERT INTO "model_list" VALUES ("105", "2", "F-150");
INSERT INTO "model_list" VALUES ("106", "2", "Mustang");
INSERT INTO "model_list" VALUES ("107", "2", "Explorer");
INSERT INTO "model_list" VALUES ("108", "3", "Golf");
INSERT INTO "model_list" VALUES ("109", "3", "Passat");
INSERT INTO "model_list" VALUES ("110", "3", "Tiguan");
INSERT INTO "model_list" VALUES ("111", "3", "Polo");
INSERT INTO "model_list" VALUES ("112", "3", "Arteon");
INSERT INTO "model_list" VALUES ("113", "4", "Elantra");
INSERT INTO "model_list" VALUES ("114", "4", "Santa Fe");
INSERT INTO "model_list" VALUES ("115", "5", "Model S");
INSERT INTO "model_list" VALUES ("116", "5", "Model 3");
INSERT INTO "model_list" VALUES ("117", "5", "Model X");
INSERT INTO "model_list" VALUES ("118", "5", "Model Y");
INSERT INTO "model_list" VALUES ("119", "6", "488 GTB");
INSERT INTO "model_list" VALUES ("120", "6", "Portofino");
INSERT INTO "model_list" VALUES ("121", "7", "XC90");
INSERT INTO "model_list" VALUES ("122", "7", "S60");
INSERT INTO "model_list" VALUES ("123", "8", "DB11");
INSERT INTO "model_list" VALUES ("124", "9", "Ghibli");
INSERT INTO "model_list" VALUES ("125", "9", "Levante");
INSERT INTO "model_list" VALUES ("126", "10", "R1T");
INSERT INTO "model_list" VALUES ("127", "10", "R1S");
INSERT INTO "car_names" VALUES ("1", "Corolla");
INSERT INTO "car_names" VALUES ("2", "F-150");
INSERT INTO "car_names" VALUES ("3", "Golf");
INSERT INTO "car_names" VALUES ("4", "Elantra");
INSERT INTO "car_names" VALUES ("5", "Model S");
INSERT INTO "car_names" VALUES ("6", "488 GTB");
INSERT INTO "car_names" VALUES ("7", "XC90");
INSERT INTO "car_names" VALUES ("8", "DB11");
INSERT INTO "car_names" VALUES ("9", "Ghibli");
INSERT INTO "car_names" VALUES ("10", "R1T");
INSERT INTO "car_makers" VALUES ("11", "Zero Models Inc.", "Nowhere");
INSERT INTO "car_makers" VALUES ("12", "Single Model Motors", "Utopia");
INSERT INTO "model_list" VALUES ("128", "12", "Solo");
INSERT INTO "car_names" VALUES ("11", "Solo");