227k views
3 votes
Which SQL statement retrieves the title, publication date, and name of publishers using the 'pubid' column to join the 'publisher' and 'books' tables?

A. SELECT title, pubdate, name FROM publisher JOIN books USING (pubid);
B. SELECT title, cost, contact, phone FROM publisher JOIN books USING (pubid);
C. SELECT name, title, retail FROM books NATURAL JOIN publisher WHERE cost > 35.95;
D. SELECT title FROM books MINUS SELECT title FROM books NATURAL JOIN orderitems;

User Teknix
by
7.2k points

1 Answer

6 votes

Final answer:

The correct SQL statement is A: SELECT title, pubdate, name FROM publisher JOIN books USING (pubid);, which retrieves the specified columns by joining the publisher and books tables on the common column pubid. Option A is correct.

Step-by-step explanation:

The SQL statement that retrieves the title, publication date, and name of publishers using the 'pubid' column to join the 'publisher' and 'books' tables is:

A. SELECT title, pubdate, name FROM publisher JOIN books USING (pubid);

This statement correctly selects the desired columns: title and pubdate from the books table, and name from the publisher table by joining the two tables on the shared column pubid. The USING clause simplifies the syntax by implicitly joining the two tables on the shared column name specified in the parenthesis.

The correct SQL statement to retrieve the title, publication date, and name of publishers using the 'pubid' column to join the 'publisher' and 'books' tables is option A:

SELECT title, pubdate, name FROM publisher JOIN books USING (pubid);

This statement uses the JOIN keyword to combine the 'publisher' and 'books' tables based on the 'pubid' column. It selects the 'title', 'pubdate', and 'name' columns from the resulting joined table.

User Patrick Berkeley
by
8.3k points