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
7
704
24
3
705
8
5
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.
Unlock full course notes by signing up
Count qualifying support tickets
A support team's tickets table contains the following complete data. attempts counts contact attempts, and resolved is 1 for resolved tickets and 0 otherwise.
How many rows does this query return? Answer as an integer row count, to zero decimal places.
Keep distinct delivery combinations
A delivery company stores the following seven records in delivery_options. Fees are exact whole numbers of US dollars, and every value is non-NULL.
The company runs this single-table query:
Complete the four output rows in their returned order. Enter each zone exactly as shown and each fee as an exact integer in US dollars.
Repair a balance-report condition
A club stores member_id, active, and balance in members. Active members have active = 1; inactive members have active = 0. Balances are USD amounts, and NULL means the balance is unrecorded. A balance of zero means nothing is owed.
The report must return active members whose balances are either positive or unrecorded. Which WHERE clause meets that requirement for every possible row?
Trace pages after order totals change
A dashboard uses pagination to display orders from a PostgreSQL table. Initially, orders contains exactly these seven records. Each order_id is unique, and total_usd is an exact order total in US dollars.
The first page is fetched with:
After the first page is fetched, two orders are added: order 508 with a total of 200 USD and order 509 with a total of 150 USD. Order 507 is also changed from 100 USD to 175 USD. No other records change, and no records are deleted.