asked 137k views
4 votes
Which of the following SQL statements will display the name of each publisher that publishes a book classified in the COMPUTER category?

a) SELECT PublisherName FROM PUBLISHER WHERE Category = 'COMPUTER';
b) SELECT PublisherName FROM PUBLISHER JOIN BOOKS ON PUBLISHER.PublisherID = BOOKS.PublisherID WHERE BOOKS.Category = 'COMPUTER';
c) SELECT PublisherName FROM BOOKS WHERE Category = 'COMPUTER' JOIN PUBLISHER ON BOOKS.PublisherID = PUBLISHER.PublisherID;
d) SELECT PublisherName FROM PUBLISHER INNER JOIN BOOKS ON PUBLISHER.PublisherID = BOOKS.PublisherID AND BOOKS.Category = 'COMPUTER';

1 Answer

6 votes

Final answer:

The correct SQL statement to display the name of each publisher that publishes a book classified in the COMPUTER category is option d) SELECT Publishe rName FROM PUBLISHER INNER JOIN BOOKS ON PUBLISHER.PublisherID = BOOKS.PublisherID AND BOOKS.Category = 'COMPUTER';

Step-by-step explanation:

The correct SQL statement that will display the name of each publisher that publishes a book classified in the COMPUTER category is option d) SELECT PublisherName FROM PUBLISHER INNER JOIN BOOKS ON PUBLISHER.PublisherID = BOOKS.PublisherID AND BOOKS.Category = 'COMPUTER';

This statement uses the INNER JOIN clause to join the PUBLISHER and BOOKS tables on the PublisherID column. It also includes the condition AND BOOKS.Category = 'COMPUTER' to filter the results by the COMPUTER category.

By executing this query, only the publishers that have books classified in the COMPUTER category will be displayed.

answered
User Mmorihiro
by
7.8k points