221k views
3 votes
Which of the following SQL statements will display the title of all books that have had multiple copies requested in a single order?

a) SELECT title FROM BOOKS WHERE copies_requested > 1
b) SELECT title FROM BOOKS JOIN ORDERITEMS ON BOOKS.book_id = ORDERITEMS.book_id GROUP BY title HAVING COUNT(*) > 1
c) SELECT title FROM BOOKS INNER JOIN ORDERITEMS ON BOOKS.book_id = ORDERITEMS.book_id WHERE copies_requested > 1
d) SELECT title FROM BOOKS JOIN ORDERITEMS ON BOOKS.book_id = ORDERITEMS.book_id AND copies_requested > 1

User Mikepurvis
by
8.9k points

1 Answer

3 votes

Final answer:

The correct SQL statement to display book titles with multiple copies requested in a single order is c) SELECT title FROM BOOKS INNER JOIN ORDERITEMS ON BOOKS.book_id = ORDERITEMS.book_id WHERE copies_requested > 1.

Step-by-step explanation:

The statement that will display the title of all books that have had multiple copies requested in a single order is:

c) SELECT title FROM BOOKS INNER JOIN ORDERITEMS ON BOOKS.book_id = ORDERITEMS.book_id WHERE copies_requested > 1

This SQL query uses the INNER JOIN clause to combine rows from the BOOKS and ORDERITEMS tables where the book_id matches. The WHERE clause is then used to filter the result set to only include books where the number of copies requested on a single order is greater than one. The query returns the desired titles reflecting multiple copies requested.

User Jeson Dias
by
7.9k points
Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.