112k views
5 votes
Structure of the PUBLISHER table

Which of the following will display the title, publication date, and publisher name of each book in the BUSINESS category?
a. SELECT title, pubdate, name
FROM publisher JOIN books USING (pubid)
WHERE category = 'BUSINESS';
b. SELECT title, pubdate, name
FROM publisher JOIN books ON (pubid)
WHERE category = 'BUSINESS';
c. SELECT title, pubdate, name
FROM publisher OUTER JOIN books USING (pubid)
WHERE category = 'BUSINESS';
d. SELECT title, pubdate, name
FROM publisher CROSS JOIN books USING (pubid)
WHERE category = 'BUSINESS';

User Warisara
by
7.7k points

1 Answer

4 votes

Final answer:

The correct SQL query to display the title, publication date, and publisher name for books in the BUSINESS category is Option a, which uses an inner join with the USING clause to join the tables on the common 'pubid' field.the result to only include books in the BUSINESS category.

Step-by-step explanation:

The correct query to display the title, publication date, and publisher name of each book in the BUSINESS category by joining the PUBLISHER table with the BOOKS table, and assuming that both tables can be joined using a common field 'pubid', is:

a. SELECT title, pubdate, name
FROM publisher JOIN books USING (pubid)
WHERE category = 'BUSINESS';

This query specifies an inner join between the PUBLISHER and BOOKS tables using the shared publisher ID (pubid). It then filters the results to only include books that are in the BUSINESS category. The use of USING (pubid) suggests that 'pubid' is a column common to both tables, representing the publisher's identifier, and it is utilized here to relate the books to their publishers.The correct SQL query to display the title, publication date, and publisher name of each book in the BUSINESS category is:

SELECT title, pubdate, name FROM publisher JOIN books USING (pubid) WHERE category = 'BUSINESS'; This query uses the JOIN clause to combine the PUBLISHER and BOOKS tables based on the publisher ID (pubid) and filters the result to only include books in the BUSINESS category.

User JanneK
by
8.0k points