Challenge: Build Leaderboards and Sequences
Oppgave
Swipe to start coding
Write a SQL query to identify the top 2 employees by their total sales amount.
- For each employee, calculate the total sales amount from the
salestable. - Assign a rank to each employee based on their total sales amount, with the highest sales getting rank 1.
- Only include employees who are ranked in the top 2.
- Display the following columns in the result:
employee_idtotal_sales(the sum of theamountfield for each employee)sales_rank(the rank assigned by your window function).
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 4
single
Spør AI
Spør AI
Spør om hva du vil, eller prøv ett av de foreslåtte spørsmålene for å starte chatten vår
Suggested prompts:
Can you explain this in simpler terms?
What are some examples related to this topic?
Where can I learn more about this?
Fantastisk!
Completion rate forbedret til 5.56
Challenge: Build Leaderboards and Sequences
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a SQL query to identify the top 2 employees by their total sales amount.
- For each employee, calculate the total sales amount from the
salestable. - Assign a rank to each employee based on their total sales amount, with the highest sales getting rank 1.
- Only include employees who are ranked in the top 2.
- Display the following columns in the result:
employee_idtotal_sales(the sum of theamountfield for each employee)sales_rank(the rank assigned by your window function).
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 3. Kapittel 4
single