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", "usa", "1");
INSERT INTO "countries" VALUES ("2", "Germany", "1");
INSERT INTO "countries" VALUES ("3", "Japan", "1");
INSERT INTO "countries" VALUES ("4", "France", "1");
INSERT INTO "countries" VALUES ("5", "South Korea", "1");
INSERT INTO "countries" VALUES ("6", "Brazil", "2");
INSERT INTO "countries" VALUES ("7", "India", "2");
INSERT INTO "car_makers" VALUES ("1", "Ford Motor Company", "1");
INSERT INTO "car_makers" VALUES ("2", "General Motors", "1");
INSERT INTO "car_makers" VALUES ("3", "Tesla, Inc.", "1");
INSERT INTO "car_makers" VALUES ("4", "Volkswagen AG", "2");
INSERT INTO "car_makers" VALUES ("5", "Toyota Motor Corporation", "3");
INSERT INTO "car_makers" VALUES ("6", "Hyundai Motor Company", "5");
INSERT INTO "car_makers" VALUES ("7", "Renault", "4");
INSERT INTO "car_makers" VALUES ("8", "Tata Motors", "7");
INSERT INTO "car_names" VALUES ("1", "Ford");
INSERT INTO "car_names" VALUES ("2", "Chevrolet");
INSERT INTO "car_names" VALUES ("3", "Tesla");
INSERT INTO "car_names" VALUES ("4", "Volkswagen");
INSERT INTO "car_names" VALUES ("5", "Toyota");
INSERT INTO "car_names" VALUES ("6", "Hyundai");
INSERT INTO "car_names" VALUES ("7", "Renault");
INSERT INTO "car_names" VALUES ("8", "Tata");
INSERT INTO "model_list" VALUES ("1", "1", "Mustang");
INSERT INTO "model_list" VALUES ("2", "1", "F-150");
INSERT INTO "model_list" VALUES ("3", "2", "Camaro");
INSERT INTO "model_list" VALUES ("4", "2", "Silverado");
INSERT INTO "model_list" VALUES ("5", "3", "Model S");
INSERT INTO "model_list" VALUES ("6", "3", "Model 3");
INSERT INTO "model_list" VALUES ("7", "4", "Golf");
INSERT INTO "model_list" VALUES ("8", "4", "Passat");
INSERT INTO "model_list" VALUES ("9", "5", "Corolla");
INSERT INTO "model_list" VALUES ("10", "5", "Camry");
INSERT INTO "model_list" VALUES ("11", "6", "Elantra");
INSERT INTO "model_list" VALUES ("12", "6", "Santa Fe");
INSERT INTO "model_list" VALUES ("13", "7", "Clio");
INSERT INTO "model_list" VALUES ("14", "7", "Megane");
INSERT INTO "model_list" VALUES ("15", "8", "Nano");
INSERT INTO "model_list" VALUES ("16", "8", "Harrier");
INSERT INTO "model_list" VALUES ("17", "1", "Explorer");
INSERT INTO "model_list" VALUES ("18", "2", "Tahoe");
INSERT INTO "model_list" VALUES ("19", "3", "Cybertruck");