Back to Practice
#0348

Orders Above Average Amount

MediumSQL24 min20 XP

Problem

Return order_id and amount for orders above the overall average amount.

Why This Matters

SQL interviews usually test whether you can turn a business question into the right rows, grouping level, join type, and edge-case behavior.

Schema

orders(order_id INTEGER, amount INTEGER)

Examples

Example 1
Inputaverage amount is 100
Outputorder 3 only

Only 150 is greater than the average 100.

Constraints

  • Return only the requested columns.
  • Use deterministic ORDER BY when multiple rows are returned.
  • Assume SQLite-compatible SQL unless the prompt states otherwise.
CodeSQL
Visible browser tests run here when available.
Testcases1 visible / 3 hidden categories
Core SQL case
Inputaverage amount is 100
Expected[[3,150]]

Only 150 is greater than the average 100.

Hidden Test Categories
Empty or missing matchesDuplicate rows or tiesNULL values where the pattern commonly breaks