39.5k views
0 votes
Which of the following lists all books published by the publisher named Printing Is US?

A. SELECT title
FROM books NATURAL JOIN publisher
WHERE name='PRINTING IS US';
B. SELECT title
FROM books, publisher
WHERE pubname=1;
C. SELECT *
FROM books b, publisher p
JOIN tables ON b.pubid = p.pubid
WHERE name='PRINTING IS US';
D. none of the above

1 Answer

3 votes

Final answer:

The correct SQL query to retrieve a list of all books published by the publisher named Printing Is US is...

Step-by-step explanation:

The correct SQL query to retrieve a list of all books published by the publisher named Printing Is US is option C: SELECT * FROM books b, publisher p JOIN tables ON b.pubid = p.pubid WHERE name='PRINTING IS US'; This query uses a join statement to combine the books and publisher tables based on the pubid column, and then filters the result to only include rows where the name column in the publisher table is equal to 'PRINTING IS US'. Option A is incorrect because it uses the NATURAL JOIN syntax, which can be risky as it matches columns with the same name across tables. Option B is incorrect because it uses a condition that attempts to match the publisher name with the value 1, which is unlikely to produce the desired result.

User Erik Youngren
by
7.7k points