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

CREATE TABLE "cars_data" (
"Id" INT,
"Edispl" FLOAT,
"Horsepower" TEXT,
"Accelerate" FLOAT,
PRIMARY KEY ("Id"),
FOREIGN KEY ("Id") REFERENCES "car_names"("MakeId")
);

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", "amc", "American Motors Corporation");
INSERT INTO "car_makers" VALUES ("2", "ford", "Ford Motor Company");
INSERT INTO "car_makers" VALUES ("3", "chevrolet", "Chevrolet");
INSERT INTO "car_makers" VALUES ("4", "plymouth", "Plymouth");
INSERT INTO "car_makers" VALUES ("5", "dodge", "Dodge");
INSERT INTO "car_makers" VALUES ("6", "toyota", "Toyota Motor Corporation");
INSERT INTO "car_makers" VALUES ("7", "honda", "Honda Motor Co.");
INSERT INTO "car_makers" VALUES ("8", "volkswagen", "Volkswagen");
INSERT INTO "car_makers" VALUES ("9", "fiat", "Fiat S.p.A.");
INSERT INTO "car_makers" VALUES ("10", "bmw", "Bayerische Motoren Werke AG");
INSERT INTO "model_list" VALUES ("101", "1", "hornet sportabout sw");
INSERT INTO "model_list" VALUES ("102", "1", "gremlin");
INSERT INTO "model_list" VALUES ("103", "2", "maverick");
INSERT INTO "model_list" VALUES ("104", "3", "vega");
INSERT INTO "model_list" VALUES ("105", "4", "satellite custom");
INSERT INTO "model_list" VALUES ("106", "5", "challenger se");
INSERT INTO "model_list" VALUES ("107", "6", "corolla 1200");
INSERT INTO "model_list" VALUES ("108", "7", "civic");
INSERT INTO "model_list" VALUES ("109", "8", "super beetle");
INSERT INTO "model_list" VALUES ("110", "9", "128");
INSERT INTO "model_list" VALUES ("111", "1", "matador sw");
INSERT INTO "model_list" VALUES ("112", "2", "pinto sw");
INSERT INTO "model_list" VALUES ("113", "3", "chevelle malibu");
INSERT INTO "model_list" VALUES ("114", "4", "fury iii");
INSERT INTO "model_list" VALUES ("115", "5", "dart custom");
INSERT INTO "model_list" VALUES ("116", "6", "corona mark ii");
INSERT INTO "model_list" VALUES ("117", "7", "accord cvcc");
INSERT INTO "model_list" VALUES ("118", "8", "dasher");
INSERT INTO "model_list" VALUES ("119", "9", "x1/9");
INSERT INTO "model_list" VALUES ("120", "10", "320i");
INSERT INTO "car_names" VALUES ("1", "hornet sportabout sw", "amc");
INSERT INTO "car_names" VALUES ("2", "gremlin", "amc");
INSERT INTO "car_names" VALUES ("3", "maverick", "ford");
INSERT INTO "car_names" VALUES ("4", "vega", "chevrolet");
INSERT INTO "car_names" VALUES ("5", "satellite custom", "plymouth");
INSERT INTO "car_names" VALUES ("6", "challenger se", "dodge");
INSERT INTO "car_names" VALUES ("7", "corolla 1200", "toyota");
INSERT INTO "car_names" VALUES ("8", "civic", "honda");
INSERT INTO "car_names" VALUES ("9", "super beetle", "volkswagen");
INSERT INTO "car_names" VALUES ("10", "128", "fiat");
INSERT INTO "car_names" VALUES ("11", "matador sw", "amc");
INSERT INTO "car_names" VALUES ("12", "pinto sw", "ford");
INSERT INTO "car_names" VALUES ("13", "chevelle malibu", "chevrolet");
INSERT INTO "car_names" VALUES ("14", "fury iii", "plymouth");
INSERT INTO "car_names" VALUES ("15", "dart custom", "dodge");
INSERT INTO "car_names" VALUES ("16", "corona mark ii", "toyota");
INSERT INTO "car_names" VALUES ("17", "accord cvcc", "honda");
INSERT INTO "car_names" VALUES ("18", "dasher", "volkswagen");
INSERT INTO "car_names" VALUES ("19", "x1/9", "fiat");
INSERT INTO "car_names" VALUES ("20", "320i", "bmw");
INSERT INTO "cars_data" VALUES ("1", "232.0", "100.0", "15.0");
INSERT INTO "cars_data" VALUES ("2", "232.0", "97.0", "15.5");
INSERT INTO "cars_data" VALUES ("3", "250.0", "88.0", "19.0");
INSERT INTO "cars_data" VALUES ("4", "140.0", "90.0", "16.0");
INSERT INTO "cars_data" VALUES ("5", "318.0", "150.0", "13.5");
INSERT INTO "cars_data" VALUES ("6", "340.0", "150.0", "12.5");
INSERT INTO "cars_data" VALUES ("7", "71.0", "65.0", "19.0");
INSERT INTO "cars_data" VALUES ("8", "120.0", "75.0", "16.0");
INSERT INTO "cars_data" VALUES ("9", "97.0", "88.0", "17.0");
INSERT INTO "cars_data" VALUES ("10", "98.0", "46.0", "20.5");
INSERT INTO "cars_data" VALUES ("11", "304.0", "150.0", "12.5");
INSERT INTO "cars_data" VALUES ("12", "122.0", "86.0", "19.5");
INSERT INTO "cars_data" VALUES ("13", "350.0", "165.0", "11.0");
INSERT INTO "cars_data" VALUES ("14", "400.0", "150.0", "14.0");
INSERT INTO "cars_data" VALUES ("15", "225.0", "105.0", "16.5");
INSERT INTO "cars_data" VALUES ("16", "120.0", "97.0", "14.5");
INSERT INTO "cars_data" VALUES ("17", "107.0", "75.0", "14.5");
INSERT INTO "cars_data" VALUES ("18", "105.0", "75.0", "16.0");
INSERT INTO "cars_data" VALUES ("19", "121.0", "66.0", "18.2");
INSERT INTO "cars_data" VALUES ("20", "121.0", "110.0", "14.0");