1 TCO 7 Consider the ERD below What tables will be needed to
1. (TCO 7) Consider the ERD below. What tables will be needed to create a report showing the firstname and lastname of customers who have placed an order for any product with keyboard in the description?
A. customer, product only
B. customer, order, product only
C. customer, orderline only
D. customer, order, orderline, product
Solution
Solution: D. customer, order, orderLine, product
Explanation:
Query to create a report showing the firstname and lastname of customers who have placed an order for any product with keyboard in the description:
To accomplish the above task keenly observe the ERD,
using productID we can get the description from Product table
Using the Combination of productID orderID we can get the corresponding order from OrderLine table
Using OrderID we can get the id of customer place from order table.
Finally we can find the first and last namses using the Customer table.
Query Looks like this:
select firstname ,lastname where customerID=(
select customerID from order where orderID =(
select orderID from OrderLine where productID in(
select productID from Productwhere description = \'keyboard\')))
