Kodewick
Start learning →
Mini challenge←→0 / 50

Median salary

#037Mini challengeCOUNT(*) OVER ()8 min

The median salary of the whole company (the average of the middle two if there is an even number). One column, one row.

The tables
departments
  • idPK
  • name
employees
  • idPK
  • name
  • dept_idFK
  • manager_id
  • salary
  • hire_date

employees.dept_id → departments.id

departments
idname
1Sales
2Engineering
3Support
4Legal
4 rows
employees
idnamedept_idmanager_idsalaryhire_date
1Marta2NULL90002019-03-01
2Paulo1170002020-01-10
3Lucas2182002020-06-15
4Sofia2195002021-02-01
5Rafael2360002023-09-04
6Julia1272002021-11-20
7Tiago1250002024-03-11
8Ines1250002024-07-01
9Nuno3145002020-09-30
10Clara3942002022-05-16
11Pedro3948002023-01-09
12VeraNULL139002025-02-03
12 rows
query.sql
-- write your query here
Ctrl + Enter runs too
Result

Run shows what your query gives. When it looks right, Submit.