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

CREATE TABLE "continents" (
"ContId" INT,
"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", "Europe");
INSERT INTO "continents" VALUES ("2", "Asia");
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 ("10", "Germany", "1");
INSERT INTO "countries" VALUES ("20", "Japan", "2");
INSERT INTO "countries" VALUES ("30", "United States", "3");
INSERT INTO "countries" VALUES ("40", "Brazil", "4");
INSERT INTO "countries" VALUES ("50", "South Africa", "5");
INSERT INTO "countries" VALUES ("60", "Australia", "6");
INSERT INTO "car_makers" VALUES ("100", "Volkswagen", "10");
INSERT INTO "car_makers" VALUES ("101", "BMW", "10");
INSERT INTO "car_makers" VALUES ("102", "Mercedes-Benz", "10");
INSERT INTO "car_makers" VALUES ("103", "Audi", "10");
INSERT INTO "car_makers" VALUES ("104", "Porsche", "10");
INSERT INTO "car_makers" VALUES ("200", "Toyota", "20");
INSERT INTO "car_makers" VALUES ("201", "Honda", "20");
INSERT INTO "car_makers" VALUES ("202", "Nissan", "20");
INSERT INTO "car_makers" VALUES ("203", "Mazda", "20");
INSERT INTO "car_makers" VALUES ("300", "Ford", "30");
INSERT INTO "car_makers" VALUES ("301", "Chevrolet", "30");
INSERT INTO "car_makers" VALUES ("302", "Tesla", "30");
INSERT INTO "car_makers" VALUES ("400", "Volkswagen Brazil", "40");
INSERT INTO "car_makers" VALUES ("500", "Toyota South Africa", "50");
INSERT INTO "car_makers" VALUES ("600", "Holden", "60");
INSERT INTO "model_list" VALUES ("1000", "100");
INSERT INTO "model_list" VALUES ("1001", "101");
INSERT INTO "model_list" VALUES ("1002", "102");
INSERT INTO "model_list" VALUES ("1003", "103");
INSERT INTO "model_list" VALUES ("1004", "104");
INSERT INTO "model_list" VALUES ("2000", "200");
INSERT INTO "model_list" VALUES ("2001", "201");
INSERT INTO "model_list" VALUES ("2002", "202");
INSERT INTO "model_list" VALUES ("2003", "203");
INSERT INTO "model_list" VALUES ("3000", "300");
INSERT INTO "model_list" VALUES ("3001", "301");
INSERT INTO "model_list" VALUES ("3002", "302");
INSERT INTO "model_list" VALUES ("4000", "400");
INSERT INTO "model_list" VALUES ("5000", "500");
INSERT INTO "model_list" VALUES ("6000", "600");