File size: 2,565 Bytes
3e7c527 |
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 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 |
PRAGMA foreign_keys = ON;
CREATE TABLE "Customers" (
"id" int,
"name" text,
"age" int,
"membership_credit" int,
PRIMARY KEY ("id")
);
INSERT INTO "Customers" VALUES (1, "Griffiths",26, 100);
INSERT INTO "Customers" VALUES (2, "Silluzio",34, 1200);
INSERT INTO "Customers" VALUES (3, "Woodman",35, 2000);
INSERT INTO "Customers" VALUES (4, "Poulter", 63, 43500);
INSERT INTO "Customers" VALUES (5, "Smith", 45, 5399);
CREATE TABLE "Discount" (
"id" int,
"name" text,
"membership_credit" int,
PRIMARY KEY ("id")
);
INSERT INTO "Discount" VALUES (1, "no discount", 0);
INSERT INTO "Discount" VALUES (2, "20% off", 1000);
INSERT INTO "Discount" VALUES (3, "40% off for over $6000", 2000);
INSERT INTO "Discount" VALUES (4, "50% off", 4000);
INSERT INTO "Discount" VALUES (5, "70% off", 400000);
CREATE TABLE "Vehicles" (
"id" int,
"name" text,
"Model_year" int,
"Type_of_powertrain" text,
"Combined_fuel_economy_rate" int,
"City_fuel_economy_rate" int,
"Highway_fuel_economy_rate" int,
"Cost_per_25_miles" real,
"Annual_fuel_cost" real,
"Notes" text,
PRIMARY KEY ("id")
);
INSERT INTO "Vehicles" VALUES (1, "Chevrolet Spark EV","2014","Electric","119","128","109","0.87","500","See (1)");
INSERT INTO "Vehicles" VALUES (2, "Honda Fit EV","2013","hybrid","118","132","105","0.87","500","See (1)");
INSERT INTO "Vehicles" VALUES (3, "Fiat 500e","2013","Electric","116","122","108","0.87","500","See (1)");
INSERT INTO "Vehicles" VALUES (4, "Nissan Leaf","2013","Electric","115","129","102","0.87","500","See (1)");
INSERT INTO "Vehicles" VALUES (5, "Mitsubishi i","2012","hybrid","112","126","99","0.90","550","best selling of the year");
INSERT INTO "Vehicles" VALUES (6, "Ford Focus Electric","2012","electric","105","110","99","0.96","600","See (2)");
INSERT INTO "Vehicles" VALUES (7, "BMW ActiveE","2011","Electric","102","107","96","0.99","600","See (1)");
CREATE TABLE "Renting_history" (
"id" int,
"customer_id" int,
"discount_id" int,
"vehicles_id" int,
"total_hours" int,
PRIMARY KEY ("id"),
FOREIGN KEY ("customer_id") REFERENCES "Customers"("id"),
FOREIGN KEY ("vehicles_id") REFERENCES "Vehicles"("id"),
FOREIGN KEY ("discount_id") REFERENCES "Discount"("id")
);
INSERT INTO "Renting_history" VALUES (1,1,1,2,1);
INSERT INTO "Renting_history" VALUES (2,2,2,5,10);
INSERT INTO "Renting_history" VALUES (3,3,3,7,24);
INSERT INTO "Renting_history" VALUES (4,4,4,3,24);
INSERT INTO "Renting_history" VALUES (5,1,1,5,36);
INSERT INTO "Renting_history" VALUES (6,2,2,1,24);
INSERT INTO "Renting_history" VALUES (7,5,4,4,72);
|