Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Oppiskele Challenge: Cumulative Sales by Region | Introduction to Window Functions
Window Functions in SQL

bookChallenge: Cumulative Sales by Region

Tehtävä

Swipe to start coding

Write a query to calculate the cumulative sales amount for each region, ordered by sale_date.

  • Select the columns sale_id, sale_date, employee_id, region, and amount from the sales table.
  • Calculate a cumulative sum of the amount column for each region, ordered by sale_date and then by sale_id.
  • Name the cumulative sum column cumulative_sales.
  • Partition the calculation by region.
  • Order the final results by region, then by sale_date, and then by sale_id.

Ratkaisu

Oliko kaikki selvää?

Miten voimme parantaa sitä?

Kiitos palautteestasi!

Osio 1. Luku 7
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 the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Cumulative Sales by Region

Pyyhkäise näyttääksesi valikon

Tehtävä

Swipe to start coding

Write a query to calculate the cumulative sales amount for each region, ordered by sale_date.

  • Select the columns sale_id, sale_date, employee_id, region, and amount from the sales table.
  • Calculate a cumulative sum of the amount column for each region, ordered by sale_date and then by sale_id.
  • Name the cumulative sum column cumulative_sales.
  • Partition the calculation by region.
  • Order the final results by region, then by sale_date, and then by sale_id.

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 1. Luku 7
single

single

some-alt