Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lära Challenge: Build Leaderboards and Sequences | Window Functions for Trends and Rankings
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL for Business Intelligence Analysts

bookChallenge: Build Leaderboards and Sequences

Uppgift

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 sales table.
  • 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_id
    • total_sales (the sum of the amount field for each employee)
    • sales_rank (the rank assigned by your window function).

Lösning

Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

Fråga AI

expand

Fråga AI

ChatGPT

Fråga vad du vill eller prova någon av de föreslagna frågorna för att starta vårt samtal

close

bookChallenge: Build Leaderboards and Sequences

Svep för att visa menyn

Uppgift

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 sales table.
  • 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_id
    • total_sales (the sum of the amount field for each employee)
    • sales_rank (the rank assigned by your window function).

Lösning

Switch to desktopByt till skrivbordet för praktisk övningFortsätt där du är med ett av alternativen nedan
Var allt tydligt?

Hur kan vi förbättra det?

Tack för dina kommentarer!

Avsnitt 3. Kapitel 4
single

single

some-alt