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

Tehtävä

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).

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 4
single

single

Kysy tekoälyä

expand

Kysy tekoälyä

ChatGPT

Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme

Suggested prompts:

Can you explain this in simpler terms?

What are some examples related to this topic?

Where can I learn more about this?

close

bookChallenge: Build Leaderboards and Sequences

Pyyhkäise näyttääksesi valikon

Tehtävä

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).

Ratkaisu

Switch to desktopVaihda työpöytään todellista harjoitusta vartenJatka siitä, missä olet käyttämällä jotakin alla olevista vaihtoehdoista
Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 3. Luku 4
single

single

some-alt