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,
"FullName" TEXT,
PRIMARY KEY ("Id")
);

CREATE TABLE "car_names" (
"MakeId" INT UNIQUE,
"Model" TEXT,
PRIMARY KEY ("MakeId"),
FOREIGN KEY ("Model") REFERENCES "model_list"("Model")
);

CREATE TABLE "cars_data" (
"Id" INT,
"Cylinders" INT,
"Accelerate" FLOAT,
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,
"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 "car_makers" VALUES ("1", "volvo", "Volvo Cars");
INSERT INTO "car_makers" VALUES ("2", "ford", "Ford Motor Company");
INSERT INTO "car_makers" VALUES ("3", "honda", "Honda Motor Co.");
INSERT INTO "car_makers" VALUES ("4", "toyota", "Toyota Motor Corporation");
INSERT INTO "car_makers" VALUES ("5", "bmw", "Bayerische Motoren Werke AG");
INSERT INTO "model_list" VALUES ("101", "1", "V70");
INSERT INTO "model_list" VALUES ("102", "1", "S60");
INSERT INTO "model_list" VALUES ("103", "1", "XC90");
INSERT INTO "model_list" VALUES ("104", "2", "Focus");
INSERT INTO "model_list" VALUES ("105", "2", "F-150");
INSERT INTO "model_list" VALUES ("106", "3", "Civic");
INSERT INTO "model_list" VALUES ("107", "3", "CR-V");
INSERT INTO "model_list" VALUES ("108", "4", "Camry");
INSERT INTO "model_list" VALUES ("109", "4", "Corolla");
INSERT INTO "model_list" VALUES ("110", "5", "3 Series");
INSERT INTO "model_list" VALUES ("111", "5", "X5");
INSERT INTO "car_names" VALUES ("1", "V70");
INSERT INTO "car_names" VALUES ("2", "S60");
INSERT INTO "car_names" VALUES ("3", "XC90");
INSERT INTO "car_names" VALUES ("4", "Focus");
INSERT INTO "car_names" VALUES ("5", "F-150");
INSERT INTO "car_names" VALUES ("6", "Civic");
INSERT INTO "car_names" VALUES ("7", "CR-V");
INSERT INTO "car_names" VALUES ("8", "Camry");
INSERT INTO "car_names" VALUES ("9", "Corolla");
INSERT INTO "car_names" VALUES ("10", "3 Series");
INSERT INTO "car_names" VALUES ("11", "X5");
INSERT INTO "cars_data" VALUES ("1", "5", "10.5");
INSERT INTO "cars_data" VALUES ("2", "4", "9.8");
INSERT INTO "cars_data" VALUES ("3", "6", "12.1");
INSERT INTO "cars_data" VALUES ("4", "4", "8.5");
INSERT INTO "cars_data" VALUES ("5", "8", "7.2");
INSERT INTO "cars_data" VALUES ("6", "4", "9.1");
INSERT INTO "cars_data" VALUES ("7", "4", "10.0");
INSERT INTO "cars_data" VALUES ("8", "4", "8.9");
INSERT INTO "cars_data" VALUES ("9", "4", "9.5");
INSERT INTO "cars_data" VALUES ("10", "6", "6.5");
INSERT INTO "cars_data" VALUES ("11", "8", "6.0");
INSERT INTO "cars_data" VALUES ("12", "5", "11.0");
INSERT INTO "cars_data" VALUES ("13", "4", "10.2");
INSERT INTO "cars_data" VALUES ("14", "6", "11.5");
INSERT INTO "cars_data" VALUES ("15", "5", "10.8");
INSERT INTO "cars_data" VALUES ("16", "4", "9.9");
INSERT INTO "cars_data" VALUES ("17", "5", "10.1");
INSERT INTO "cars_data" VALUES ("18", "4", "9.3");
INSERT INTO "cars_data" VALUES ("19", "4", "9.7");
INSERT INTO "cars_data" VALUES ("20", "6", "6.8");
INSERT INTO "cars_data" VALUES ("21", "8", "6.2");