Median and average duration by device

Median and average duration by device

From the sessions table, for each device compute the median of duration_sec (median_duration) and the average duration rounded to 2 decimals (avg_duration). Return device, median_duration, avg_duration ordered by device ascending.

Row order matters

PostgreSQLv16

Your query result will appear here

Focus radio
Paused · SomaFM · Fluid