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,
"Horsepower" TEXT,
"Year" INT,
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", "ford", "Ford Motor Company");
INSERT INTO "car_makers" VALUES ("2", "chevrolet", "Chevrolet");
INSERT INTO "car_makers" VALUES ("3", "plymouth", "Plymouth");
INSERT INTO "car_makers" VALUES ("4", "amc", "American Motors Corporation");
INSERT INTO "car_makers" VALUES ("5", "dodge", "Dodge");
INSERT INTO "car_makers" VALUES ("6", "volkswagen", "Volkswagen");
INSERT INTO "car_makers" VALUES ("7", "toyota", "Toyota");
INSERT INTO "car_makers" VALUES ("8", "nissan", "Nissan");
INSERT INTO "car_makers" VALUES ("9", "honda", "Honda");
INSERT INTO "car_makers" VALUES ("10", "fiat", "Fiat");
INSERT INTO "car_makers" VALUES ("11", "bmw", "BMW");
INSERT INTO "model_list" VALUES ("1", "1", "ford galaxie 500");
INSERT INTO "model_list" VALUES ("2", "1", "ford torino");
INSERT INTO "model_list" VALUES ("3", "2", "chevrolet chevelle malibu");
INSERT INTO "model_list" VALUES ("4", "2", "chevrolet impala");
INSERT INTO "model_list" VALUES ("5", "3", "plymouth fury iii");
INSERT INTO "model_list" VALUES ("6", "3", "plymouth satellite");
INSERT INTO "model_list" VALUES ("7", "4", "amc rebel sst");
INSERT INTO "model_list" VALUES ("8", "5", "dodge challenger se");
INSERT INTO "model_list" VALUES ("9", "6", "volkswagen type 3");
INSERT INTO "model_list" VALUES ("10", "7", "toyota corona mark ii");
INSERT INTO "model_list" VALUES ("11", "1", "ford pinto");
INSERT INTO "model_list" VALUES ("12", "2", "chevrolet vega 2300");
INSERT INTO "model_list" VALUES ("13", "6", "volkswagen super beetle");
INSERT INTO "model_list" VALUES ("14", "8", "datsun 510");
INSERT INTO "model_list" VALUES ("15", "9", "honda civic");
INSERT INTO "model_list" VALUES ("16", "10", "fiat 128");
INSERT INTO "model_list" VALUES ("17", "11", "bmw 2002");
INSERT INTO "model_list" VALUES ("18", "1", "ford mustang");
INSERT INTO "model_list" VALUES ("19", "2", "chevrolet camaro");
INSERT INTO "model_list" VALUES ("20", "3", "plymouth duster");
INSERT INTO "car_names" VALUES ("1", "ford galaxie 500", "ford");
INSERT INTO "car_names" VALUES ("2", "ford torino", "ford");
INSERT INTO "car_names" VALUES ("3", "chevrolet chevelle malibu", "chevrolet");
INSERT INTO "car_names" VALUES ("4", "chevrolet impala", "chevrolet");
INSERT INTO "car_names" VALUES ("5", "plymouth fury iii", "plymouth");
INSERT INTO "car_names" VALUES ("6", "plymouth satellite", "plymouth");
INSERT INTO "car_names" VALUES ("7", "amc rebel sst", "amc");
INSERT INTO "car_names" VALUES ("8", "dodge challenger se", "dodge");
INSERT INTO "car_names" VALUES ("9", "volkswagen type 3", "volkswagen");
INSERT INTO "car_names" VALUES ("10", "toyota corona mark ii", "toyota");
INSERT INTO "car_names" VALUES ("11", "ford pinto", "ford");
INSERT INTO "car_names" VALUES ("12", "chevrolet vega 2300", "chevrolet");
INSERT INTO "car_names" VALUES ("13", "volkswagen super beetle", "volkswagen");
INSERT INTO "car_names" VALUES ("14", "datsun 510", "nissan");
INSERT INTO "car_names" VALUES ("15", "honda civic", "honda");
INSERT INTO "car_names" VALUES ("16", "fiat 128", "fiat");
INSERT INTO "car_names" VALUES ("17", "bmw 2002", "bmw");
INSERT INTO "car_names" VALUES ("18", "ford mustang", "ford");
INSERT INTO "car_names" VALUES ("19", "chevrolet camaro", "chevrolet");
INSERT INTO "car_names" VALUES ("20", "plymouth duster", "plymouth");
INSERT INTO "cars_data" VALUES ("1", "198", "1970");
INSERT INTO "cars_data" VALUES ("2", "165", "1970");
INSERT INTO "cars_data" VALUES ("3", "150", "1970");
INSERT INTO "cars_data" VALUES ("4", "150", "1970");
INSERT INTO "cars_data" VALUES ("5", "150", "1970");
INSERT INTO "cars_data" VALUES ("6", "150", "1970");
INSERT INTO "cars_data" VALUES ("7", "150", "1970");
INSERT INTO "cars_data" VALUES ("8", "150", "1970");
INSERT INTO "cars_data" VALUES ("9", "88", "1970");
INSERT INTO "cars_data" VALUES ("10", "95", "1970");
INSERT INTO "cars_data" VALUES ("11", "75", "1971");
INSERT INTO "cars_data" VALUES ("12", "90", "1971");
INSERT INTO "cars_data" VALUES ("13", "76", "1971");
INSERT INTO "cars_data" VALUES ("14", "97", "1971");
INSERT INTO "cars_data" VALUES ("15", "75", "1972");
INSERT INTO "cars_data" VALUES ("16", "49", "1972");
INSERT INTO "cars_data" VALUES ("17", "94", "1972");
INSERT INTO "cars_data" VALUES ("18", "140", "1970");
INSERT INTO "cars_data" VALUES ("19", "155", "1970");
INSERT INTO "cars_data" VALUES ("20", "145", "1970");