Interview › Median

SQL interview: median in SQL Server

Median is the middle row after you sort. Average is a different question.

Prompt. Median total_amount of Orders.

Hint: PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY total_amount)

PERCENTILE_CONT interpolates. PERCENTILE_DISC picks a real row. Say which.

Then write it on a ticket

Monday is free. A colleague asks, you type, we mark it.

Clock in free