Question: QUESTION 4 Answer (a), (b) and (c) Consider the following relational schema for a company: CUSTOMER (CustomerID, CustomerName, CustomerAddress, CustomerCity, CustomerState, CustomerPostalCode) ORDER (OrderID, OrderDate,

QUESTION 4 Answer (a), (b) and (c) Consider the following relational schema for a company: CUSTOMER (CustomerID, CustomerName, CustomerAddress, CustomerCity, CustomerState, CustomerPostalCode) ORDER (OrderID, OrderDate, CustomerID) ORDER-LINE (OrderID, ProductID, OrderedQuantity) PRODUCT (ProductID, ProductDescription, ProductFinish, ProductStandardPrice) The key attributes for the relations shown above are underlined, and other important attributes are included in each relation. The primary key for ORDER-LINE is a composite key consisting of the attributes OrderID and ProductID. Also, CustomerID is a foreign key in the ORDER relation. ORDER-LINE has two foreign keys: OrderID and ProductID. Write SQL queries to answer the following: (a) Write statements to create all the tables from relational schema described above. Select appropriate data types for each attribute. Remember to set the primary and foreign keys. (16 marks) (b) Write a query to list all orders (order id and its date) submitted by a customer with id cus0019 since 1st of December 2016. (4 marks) (c) List the total ordered quantity of all orders by each customer while considering only the customers who ordered more than 65.

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!