Trace filtered and sorted inventory values

A retailer's products table contains the following complete data. Unit prices are in USD per item, and stock values are item counts.


product_id

unit_price

stock

701

16

4

702

12

0

703

16

7

704

24

3

705

8

5


SQL
SELECT product_id, unit_price * stock AS inventory_value
FROM products
WHERE stock > 0 AND unit_price <= 16
ORDER BY unit_price DESC, product_id DESC;


Complete the three result rows in their returned order. Enter product identifiers and inventory values as exact integers; inventory values are in USD.

Result positionproduct_idinventory_value (USD)
1
2
3

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Single Table Queries Questions: