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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started