13.9k views
0 votes
Which of the following SQL statements retrieves names, titles, and retail prices from the books table, where the cost is greater than $35.95?

A. SELECT title FROM orders o, orderitems oi, books b WHERE = AND # = # AND (orderdate-pubdate)/365 >= 3;
B. SELECT name, title, retail FROM books NATURAL JOIN publisher WHERE cost > 35.95;
C. SELECT UNIQUE name FROM books NATURAL JOIN publisher WHERE category = 'COMPUTER';
D. SELECT title, pubdate, name FROM publisher JOIN books USING (pubid);

User Markhogue
by
8.6k points

1 Answer

6 votes

Final answer:

The correct SQL statement for the given question is option B, which accurately retrieves the needed fields and filters based on the cost criteria.

Step-by-step explanation:

The correct SQL statement to retrieve names, titles, and retail prices from the books table, where the cost is greater than $35.95 is:

B: SELECT name, title, retail FROM books NATURAL JOIN publisher WHERE cost > 35.95.

This query uses a NATURAL JOIN to combine records from the books table and the publisher table, and the WHERE clause to filter out books that cost less than $35.95. No other options provided in the question correctly retrieve the specified fields while also filtering based on cost.

The correct SQL statement that retrieves names, titles, and retail prices from the books table, where the cost is greater than $35.95 is option B: SELECT name, title, retail FROM books NATURAL JOIN publisher WHERE cost > 35.95. This statement joins the books table with the publisher table and selects the desired columns (name, title, retail) from the books table using the condition cost > 35.95 to filter the results.

Therefore the correct option is B. SELECT name, title, retail FROM books NATURAL JOIN publisher WHERE cost > 35.95.

User Hoppeduppeanut
by
8.5k points