98.7k views
5 votes
Which of the following SQL statements will display the gift that should be sent to any customer who orders the book titled THE WOK WAY TO COOK?

a) SELECT Gift FROM PROMOTION JOIN BOOKS ON PROMOTION.BookID = BOOKS.BookID WHERE Title = 'THE WOK WAY TO COOK'
b) SELECT Gift FROM PROMOTION JOIN ORDERITEMS ON PROMOTION.BookID = ORDERITEMS.BookID JOIN BOOKS ON ORDERITEMS.BookID = BOOKS.BookID WHERE Title = 'THE WOK WAY TO COOK'
c) SELECT Gift FROM PROMOTION WHERE BookID IN (SELECT BookID FROM BOOKS WHERE Title = 'THE WOK WAY TO COOK')
d) SELECT Gift FROM PROMOTION JOIN ORDERS ON PROMOTION.OrderID = ORDERS.OrderID JOIN BOOKS ON ORDERS.BookID = BOOKS.BookID WHERE Title = 'THE WOK WAY TO COOK'

1 Answer

2 votes

Final answer:

The correct SQL statement is option d. It joins the PROMOTION, ORDERS, and BOOKS tables to retrieve the gift associated with the order for the book titled THE WOK WAY TO COOK.

Step-by-step explanation:

The correct SQL statement that will display the gift that should be sent to any customer who orders the book titled THE WOK WAY TO COOK is:

d) SELECT Gift FROM PROMOTION JOIN ORDERS ON PROMOTION.OrderID = ORDERS.OrderID JOIN BOOKS ON ORDERS.BookID = BOOKS.BookID WHERE Title = 'THE WOK WAY TO COOK'

This statement joins the PROMOTION table with the ORDERS table and the BOOKS table to retrieve the gift associated with the order for the specified book title.

User Priceline
by
8.0k points