Question: (i) SQL, (ii) Relational algebra (iii) Relational Calculus as well as showing the (iv) result of each query. CUSTOMER TABLE CREATE TABLE CUSTOMER ( Cus#

(i) SQL,

(ii) Relational algebra

(iii) Relational Calculus as well as showing the

(iv) result of each query.

CUSTOMER TABLE

CREATE TABLE CUSTOMER ( Cus# int NOT NULL, Cname VARCHAR(255), City VARCHAR(255), PRIMARY KEY (Cus#) );

ORDER TABLE:

CREATE TABLE ORDER( Order# int NOT NULL, Cus# int NOT NULL, Odate DATE, Ord_Amt INT, PRIMARY KEY ( Order#), FOREIGN KEY (Cus#) REFERENCES CUSTOMER(Cus#) );

ORDER_ITEM TABLE:

CREATE TABLE ORDER( Order# int NOT NULL, Item# int NOT NULL, Qty INT, PRIMARY KEY ( Order#), PRIMARY KEY (Item#), FOREIGN KEY (Order#) REFERENCES Order(Order#), FOREIGN KEY (Item#) REFERENCES Item(Item#) );

ITEM TABLE:

CREATE TABLE ITEM( Item# int NOT NULL, Unit_Price INT, PRIMARY KEY (Item#) );

SHIPMENT TABLE:

CREATE TABLE SHIPMENT( Shipment# int NOT NULL, Order# int NOT NULL, Ship_Date DATE, PRIMARY KEY Shipment#) FOREIGN KEY (Order#) REFERENCES Order(Order#), );

WAREHOUSE TABLE:

CREATE TABLE WAREOUSE( Warehouse# int NOT NULL, City VARCHAR(55), PRIMARY KEY (Warehouse#) );

Answer the following queries with each one of these

Note: specify any needed aggregate function or group by attributes within your relational calculus and algebra queries appropriately.

(a). Retrieve the quantity and price of items ordered by a customer.

(b). Retrieve the city, order date and shipment date of an order

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!