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.
▲ Console

Install Talent Arabia

Get instant access to jobs and career tools on your device.