Challenge: Top 3 Salaries per Department
Compito
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, andsalarycolumns. - 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 bysalarydescending, and then byname.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 2
single
Chieda ad AI
Chieda ad AI
Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione
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?
Fantastico!
Completion tasso migliorato a 4.55
Challenge: Top 3 Salaries per Department
Scorri per mostrare il menu
Compito
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, andsalarycolumns. - 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 bysalarydescending, and then byname.
Soluzione
Tutto è chiaro?
Grazie per i tuoi commenti!
Sezione 2. Capitolo 2
single