Database · Medium
Find the median salary of all employees.
DatabaseSQL QueriesSeniorAggregation
Answer preview
Use the ordered-set aggregate PERCENTILE_CONT(0.5) WITHIN GROUP (ORDER BY salary), which interpolates between the two middle values when the row count is even.…