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"),
FOREIGN KEY ("Country") REFERENCES "countries"("CountryId")
);

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

CREATE TABLE "countries" (
"CountryId" INT UNIQUE,
"CountryName" TEXT,
"Continent" INT,
PRIMARY KEY ("CountryId")
);

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





INSERT INTO "countries" VALUES ("1", "United States", "1");
INSERT INTO "countries" VALUES ("2", "Germany", "1");
INSERT INTO "countries" VALUES ("3", "Japan", "1");
INSERT INTO "countries" VALUES ("4", "South Korea", "1");
INSERT INTO "countries" VALUES ("5", "France", "1");
INSERT INTO "countries" VALUES ("6", "Italy", "1");
INSERT INTO "countries" VALUES ("7", "Brazil", "2");
INSERT INTO "countries" VALUES ("8", "Canada", "1");
INSERT INTO "countries" VALUES ("9", "Mexico", "1");
INSERT INTO "countries" VALUES ("10", "China", "3");
INSERT INTO "car_makers" VALUES ("101", "Ford Motor Company", "1");
INSERT INTO "car_makers" VALUES ("102", "General Motors", "1");
INSERT INTO "car_makers" VALUES ("103", "Tesla, Inc.", "1");
INSERT INTO "car_makers" VALUES ("104", "BMW AG", "2");
INSERT INTO "car_makers" VALUES ("105", "Toyota Motor Corporation", "3");
INSERT INTO "car_makers" VALUES ("106", "Hyundai Motor Company", "4");
INSERT INTO "car_makers" VALUES ("107", "Renault", "5");
INSERT INTO "car_makers" VALUES ("108", "Fiat Chrysler Automobiles", "6");
INSERT INTO "car_makers" VALUES ("109", "Volkswagen AG", "2");
INSERT INTO "car_makers" VALUES ("110", "Honda Motor Co., Ltd.", "3");
INSERT INTO "car_names" VALUES ("101", "Ford");
INSERT INTO "car_names" VALUES ("102", "GM");
INSERT INTO "car_names" VALUES ("103", "Tesla");
INSERT INTO "car_names" VALUES ("104", "BMW");
INSERT INTO "car_names" VALUES ("105", "Toyota");
INSERT INTO "car_names" VALUES ("106", "Hyundai");
INSERT INTO "car_names" VALUES ("107", "Renault");
INSERT INTO "car_names" VALUES ("108", "Fiat Chrysler");
INSERT INTO "car_names" VALUES ("109", "Volkswagen");
INSERT INTO "car_names" VALUES ("110", "Honda");
INSERT INTO "model_list" VALUES ("1001", "101", "Mustang");
INSERT INTO "model_list" VALUES ("1002", "101", "F-150");
INSERT INTO "model_list" VALUES ("1003", "101", "Explorer");
INSERT INTO "model_list" VALUES ("1004", "102", "Chevrolet Silverado");
INSERT INTO "model_list" VALUES ("1005", "102", "Cadillac Escalade");
INSERT INTO "model_list" VALUES ("1006", "102", "GMC Sierra");
INSERT INTO "model_list" VALUES ("1007", "103", "Model S");
INSERT INTO "model_list" VALUES ("1008", "103", "Model 3");
INSERT INTO "model_list" VALUES ("1009", "103", "Model X");
INSERT INTO "model_list" VALUES ("1010", "104", "3 Series");
INSERT INTO "model_list" VALUES ("1011", "104", "X5");
INSERT INTO "model_list" VALUES ("1012", "105", "Corolla");
INSERT INTO "model_list" VALUES ("1013", "105", "Camry");
INSERT INTO "model_list" VALUES ("1014", "106", "Elantra");
INSERT INTO "model_list" VALUES ("1015", "106", "Santa Fe");
INSERT INTO "model_list" VALUES ("1016", "107", "Clio");
INSERT INTO "model_list" VALUES ("1017", "107", "Megane");
INSERT INTO "model_list" VALUES ("1018", "108", "500");
INSERT INTO "model_list" VALUES ("1019", "108", "Panda");
INSERT INTO "model_list" VALUES ("1020", "109", "Golf");
INSERT INTO "model_list" VALUES ("1021", "109", "Passat");
INSERT INTO "model_list" VALUES ("1022", "110", "Civic");
INSERT INTO "model_list" VALUES ("1023", "110", "Accord");
INSERT INTO "model_list" VALUES ("1024", "101", "Bronco");
INSERT INTO "model_list" VALUES ("1025", "102", "Chevrolet Bolt");
INSERT INTO "model_list" VALUES ("1026", "103", "Cybertruck");
INSERT INTO "model_list" VALUES ("1027", "101", "Edge");
INSERT INTO "model_list" VALUES ("1028", "101", "Escape");
INSERT INTO "model_list" VALUES ("1029", "102", "Buick Enclave");
INSERT INTO "model_list" VALUES ("1030", "102", "Chevrolet Tahoe");