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

bookChallenge: Cumulative Sales by Region

Tâche

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.

Solution

Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 7
single

single

Demandez à l'IA

expand

Demandez à l'IA

ChatGPT

Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion

close

bookChallenge: Cumulative Sales by Region

Glissez pour afficher le menu

Tâche

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.

Solution

Switch to desktopPassez à un bureau pour une pratique réelleContinuez d'où vous êtes en utilisant l'une des options ci-dessous
Tout était clair ?

Comment pouvons-nous l'améliorer ?

Merci pour vos commentaires !

Section 1. Chapitre 7
single

single

some-alt