DataLane

20. Median completed order amount

hardProNot started~18 minStatisticsWindow functions

Asked in screens shaped like: Capital One, JPMorgan, Robinhood

Report the median completed order amount without a percentile function. The median is the middle value for an odd count and the average of the two middle values for an even count, so the solution has to handle both.

Requirements

  • Columns: median_amount
  • Only status = 'completed'
  • Exactly one row
  • median_amount rounded to 2 decimals

Expected output

median_amount

Row order is not graded on this problem.

SQL editor

Loading SQL engine…

Ctrl/Cmd + Enter submits

Run your query to see the result set.

Pro problem

Hard problems unlock with Pro

Easy pads stay free. Medium and hard SQL and Python problems — editor, tests, hints, and solutions — open after you upgrade to Pro or coaching.

See plansPractice free easy problems
↑↓ navigate openesc close