Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Aprenda 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

Tarefa

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.

Solução

Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 2
single

single

Pergunte à IA

expand

Pergunte à IA

ChatGPT

Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo

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

Deslize para mostrar o menu

Tarefa

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.

Solução

Switch to desktopMude para o desktop para praticar no mundo realContinue de onde você está usando uma das opções abaixo
Tudo estava claro?

Como podemos melhorá-lo?

Obrigado pelo seu feedback!

Seção 2. Capítulo 2
single

single

some-alt