Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprende Challenge: Top 3 Salaries per Department | Ranking and Analytic Window Functions
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
Window Functions in SQL

bookChallenge: Top 3 Salaries per Department

Tarea

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.

Solución

¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 2
single

single

Pregunte a AI

expand

Pregunte a AI

ChatGPT

Pregunte lo que quiera o pruebe una de las preguntas sugeridas para comenzar nuestra charla

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

Desliza para mostrar el menú

Tarea

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.

Solución

Switch to desktopCambia al escritorio para practicar en el mundo realContinúe desde donde se encuentra utilizando una de las siguientes opciones
¿Todo estuvo claro?

¿Cómo podemos mejorarlo?

¡Gracias por tus comentarios!

Sección 2. Capítulo 2
single

single

some-alt