SQL: Median Employee Salary
Medium
SQL — Window Functions
SQL
ROW_NUMBER
Median
Find median salary per company.
Constraints
Write standard SQL (MySQL 8.0 compatible).
Examples
Example 1:
Input: company salary
A 100
A 200
A 300
Output:
Example 2:
Input: company salary
A 100
A 200
A 300
Output:
Hints
Window functions with row numbering.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console