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

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

CREATE TABLE "continents" (
"ContId" INT UNIQUE,
"Continent" TEXT,
PRIMARY KEY ("ContId")
);

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

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





INSERT INTO "continents" VALUES ("1", "Asia");
INSERT INTO "continents" VALUES ("2", "Europe");
INSERT INTO "continents" VALUES ("3", "North America");
INSERT INTO "continents" VALUES ("4", "South America");
INSERT INTO "continents" VALUES ("5", "Africa");
INSERT INTO "continents" VALUES ("6", "Oceania");
INSERT INTO "countries" VALUES ("1", "Japan", "1");
INSERT INTO "countries" VALUES ("2", "Germany", "2");
INSERT INTO "countries" VALUES ("3", "USA", "3");
INSERT INTO "countries" VALUES ("4", "France", "2");
INSERT INTO "countries" VALUES ("5", "Italy", "2");
INSERT INTO "countries" VALUES ("6", "South Korea", "1");
INSERT INTO "countries" VALUES ("7", "Brazil", "4");
INSERT INTO "countries" VALUES ("8", "Australia", "6");
INSERT INTO "countries" VALUES ("9", "China", "1");
INSERT INTO "countries" VALUES ("10", "India", "1");
INSERT INTO "car_makers" VALUES ("1", "1");
INSERT INTO "car_makers" VALUES ("2", "2");
INSERT INTO "car_makers" VALUES ("3", "3");
INSERT INTO "car_makers" VALUES ("4", "4");
INSERT INTO "car_makers" VALUES ("5", "5");
INSERT INTO "car_makers" VALUES ("6", "1");
INSERT INTO "car_makers" VALUES ("7", "3");
INSERT INTO "car_makers" VALUES ("8", "6");
INSERT INTO "car_makers" VALUES ("9", "9");
INSERT INTO "car_makers" VALUES ("10", "10");
INSERT INTO "car_makers" VALUES ("11", "2");
INSERT INTO "car_makers" VALUES ("12", "3");
INSERT INTO "car_names" VALUES ("1", "Toyota");
INSERT INTO "car_names" VALUES ("2", "BMW");
INSERT INTO "car_names" VALUES ("3", "Ford");
INSERT INTO "car_names" VALUES ("4", "Renault");
INSERT INTO "car_names" VALUES ("5", "Fiat");
INSERT INTO "car_names" VALUES ("6", "Honda");
INSERT INTO "car_names" VALUES ("7", "Chevrolet");
INSERT INTO "car_names" VALUES ("8", "Hyundai");
INSERT INTO "car_names" VALUES ("9", "Geely");
INSERT INTO "car_names" VALUES ("10", "Tata");
INSERT INTO "car_names" VALUES ("11", "Mercedes-Benz");
INSERT INTO "car_names" VALUES ("12", "Tesla");
INSERT INTO "model_list" VALUES ("101", "1");
INSERT INTO "model_list" VALUES ("102", "1");
INSERT INTO "model_list" VALUES ("201", "2");
INSERT INTO "model_list" VALUES ("202", "2");
INSERT INTO "model_list" VALUES ("301", "3");
INSERT INTO "model_list" VALUES ("302", "3");
INSERT INTO "model_list" VALUES ("401", "4");
INSERT INTO "model_list" VALUES ("501", "5");
INSERT INTO "model_list" VALUES ("601", "6");
INSERT INTO "model_list" VALUES ("701", "7");
INSERT INTO "model_list" VALUES ("801", "8");
INSERT INTO "model_list" VALUES ("901", "9");
INSERT INTO "model_list" VALUES ("1001", "10");
INSERT INTO "model_list" VALUES ("1101", "11");
INSERT INTO "model_list" VALUES ("1201", "12");