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.
order_id
total_usd
501
150
502
120
503
180
504
90
505
506
110
507
100
The first page is fetched with:
SELECT order_id FROM orders ORDER BY total_usd DESC, order_id ASC LIMIT 3 OFFSET 0;
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.
The second page is then fetched with:
SELECT order_id FROM orders ORDER BY total_usd DESC, order_id ASC LIMIT 3 OFFSET 3;
Assume each query sees the table as it exists when that query runs; the first page retains the IDs it originally displayed.
Determine both quantities as exact integer counts:
Unlock full course notes by signing up
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.
Complete the three result rows in their returned order. Enter product identifiers and inventory values as exact integers; inventory values are in USD.
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?