File size: 963 Bytes
2abe051 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
CREATE TABLE "continents" (
"ContId" INTEGER PRIMARY KEY,
"Continent" TEXT
);
CREATE TABLE "countries" (
"CountryId" INTEGER PRIMARY KEY,
"CountryName" TEXT,
"Continent" INTEGER,
FOREIGN KEY (Continent) REFERENCES continents(ContId)
);
CREATE TABLE "car_makers" (
"Id" INTEGER PRIMARY KEY,
"Maker" TEXT,
"FullName" TEXT,
"Country" TEXT,
FOREIGN KEY (Country) REFERENCES countries(CountryId)
);
CREATE TABLE "model_list" (
"ModelId" INTEGER PRIMARY KEY,
"Maker" INTEGER,
"Model" TEXT UNIQUE,
FOREIGN KEY (Maker) REFERENCES car_makers (Id)
);
CREATE TABLE "car_names" (
"MakeId" INTEGER PRIMARY KEY,
"Model" TEXT,
"Make" TEXT,
FOREIGN KEY (Model) REFERENCES model_list (Model)
);
CREATE TABLE "cars_data" (
"Id" INTEGER PRIMARY KEY,
"MPG" TEXT,
"Cylinders" INTEGER,
"Edispl" REAL,
"Horsepower" TEXT,
"Weight" INTEGER,
"Accelerate" REAL,
"Year" INTEGER,
FOREIGN KEY (Id) REFERENCES car_names (MakeId)
);
|