SQL: Salary Percentile
Medium
SQL — Window Functions
SQL
PERCENT_RANK
Calculate salary percentile for each employee.
Constraints
Write standard SQL (MySQL 8.0 compatible).
Examples
Example 1:
Input: salary: 30K,50K,70K,90K
Output:
Example 2:
Input: salary: 30K,50K,70K,90K
Output:
Hints
PERCENT_RANK or CUME_DIST.
Tests:
Runtime:
Memory:
Test
Input:
Expected:
Got:
Click Run Code to test against sample cases, or Submit to test against all cases.
▲ Console