Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Top 3 Salaries per Department | Ranking and Analytic Window Functions
Window Functions in SQL

bookChallenge: Top 3 Salaries per Department

Taak

Swipe to start coding

Write a query to list the top 3 employees by salary in each department using a ranking window function.

  • Select the employee_id, name, department, and salary columns.
  • Use a ranking window function to assign a rank to each employee within their department, ordered by salary in descending order.
  • Return only those employees whose rank is 3 or less.
  • Order the results by department, then by salary descending, and then by name.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 2
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

Suggested prompts:

Can you explain that in simpler terms?

What are the main benefits of this approach?

Are there any common mistakes to avoid with this?

close

bookChallenge: Top 3 Salaries per Department

Veeg om het menu te tonen

Taak

Swipe to start coding

Write a query to list the top 3 employees by salary in each department using a ranking window function.

  • Select the employee_id, name, department, and salary columns.
  • Use a ranking window function to assign a rank to each employee within their department, ordered by salary in descending order.
  • Return only those employees whose rank is 3 or less.
  • Order the results by department, then by salary descending, and then by name.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 2. Hoofdstuk 2
single

single

some-alt