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,
"Model" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY ("Model") REFERENCES "model_list"("Model")
);

CREATE TABLE "cars_data" (
"Id" INT,
PRIMARY KEY ("Id"),
FOREIGN KEY ("Id") REFERENCES "car_names"("MakeId")
);

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

CREATE TABLE "countries" (
"CountryId" INT UNIQUE,
"CountryName" TEXT,
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 "continents" VALUES ("1", "North America");
INSERT INTO "continents" VALUES ("2", "Europe");
INSERT INTO "continents" VALUES ("3", "Asia");
INSERT INTO "continents" VALUES ("4", "South America");
INSERT INTO "continents" VALUES ("5", "Africa");
INSERT INTO "continents" VALUES ("6", "Oceania");
INSERT INTO "countries" VALUES ("1", "usa");
INSERT INTO "countries" VALUES ("2", "Germany");
INSERT INTO "countries" VALUES ("3", "Japan");
INSERT INTO "countries" VALUES ("4", "Italy");
INSERT INTO "countries" VALUES ("5", "France");
INSERT INTO "countries" VALUES ("6", "UK");
INSERT INTO "countries" VALUES ("7", "South Korea");
INSERT INTO "countries" VALUES ("8", "Sweden");
INSERT INTO "countries" VALUES ("9", "China");
INSERT INTO "countries" VALUES ("10", "India");
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", "1");
INSERT INTO "car_makers" VALUES ("5", "4");
INSERT INTO "car_makers" VALUES ("6", "2");
INSERT INTO "car_makers" VALUES ("7", "3");
INSERT INTO "car_makers" VALUES ("8", "1");
INSERT INTO "car_makers" VALUES ("9", "5");
INSERT INTO "car_makers" VALUES ("10", "6");
INSERT INTO "model_list" VALUES ("1", "1", "F-150");
INSERT INTO "model_list" VALUES ("2", "1", "Mustang");
INSERT INTO "model_list" VALUES ("3", "2", "3 Series");
INSERT INTO "model_list" VALUES ("4", "2", "C-Class");
INSERT INTO "model_list" VALUES ("5", "3", "Camry");
INSERT INTO "model_list" VALUES ("6", "3", "Civic");
INSERT INTO "model_list" VALUES ("7", "4", "Silverado");
INSERT INTO "model_list" VALUES ("8", "4", "Corvette");
INSERT INTO "model_list" VALUES ("9", "5", "Giulia");
INSERT INTO "model_list" VALUES ("10", "6", "Golf");
INSERT INTO "model_list" VALUES ("11", "7", "Accord");
INSERT INTO "model_list" VALUES ("12", "8", "Ram 1500");
INSERT INTO "model_list" VALUES ("13", "8", "Challenger");
INSERT INTO "model_list" VALUES ("14", "9", "208");
INSERT INTO "model_list" VALUES ("15", "10", "Mini Cooper");
INSERT INTO "model_list" VALUES ("16", "1", "Explorer");
INSERT INTO "model_list" VALUES ("17", "4", "Tahoe");
INSERT INTO "model_list" VALUES ("18", "8", "Charger");
INSERT INTO "car_names" VALUES ("1", "F-150");
INSERT INTO "car_names" VALUES ("2", "Mustang");
INSERT INTO "car_names" VALUES ("3", "3 Series");
INSERT INTO "car_names" VALUES ("4", "C-Class");
INSERT INTO "car_names" VALUES ("5", "Camry");
INSERT INTO "car_names" VALUES ("6", "Civic");
INSERT INTO "car_names" VALUES ("7", "Silverado");
INSERT INTO "car_names" VALUES ("8", "Corvette");
INSERT INTO "car_names" VALUES ("9", "Giulia");
INSERT INTO "car_names" VALUES ("10", "Golf");
INSERT INTO "car_names" VALUES ("11", "Accord");
INSERT INTO "car_names" VALUES ("12", "Ram 1500");
INSERT INTO "car_names" VALUES ("13", "Challenger");
INSERT INTO "car_names" VALUES ("14", "208");
INSERT INTO "car_names" VALUES ("15", "Mini Cooper");
INSERT INTO "car_names" VALUES ("16", "Explorer");
INSERT INTO "car_names" VALUES ("17", "Tahoe");
INSERT INTO "car_names" VALUES ("18", "Charger");
INSERT INTO "cars_data" VALUES ("1");
INSERT INTO "cars_data" VALUES ("2");
INSERT INTO "cars_data" VALUES ("3");
INSERT INTO "cars_data" VALUES ("4");
INSERT INTO "cars_data" VALUES ("5");
INSERT INTO "cars_data" VALUES ("6");
INSERT INTO "cars_data" VALUES ("7");
INSERT INTO "cars_data" VALUES ("8");
INSERT INTO "cars_data" VALUES ("9");
INSERT INTO "cars_data" VALUES ("10");
INSERT INTO "cars_data" VALUES ("11");
INSERT INTO "cars_data" VALUES ("12");
INSERT INTO "cars_data" VALUES ("13");
INSERT INTO "cars_data" VALUES ("14");
INSERT INTO "cars_data" VALUES ("15");
INSERT INTO "cars_data" VALUES ("16");
INSERT INTO "cars_data" VALUES ("17");
INSERT INTO "cars_data" VALUES ("18");