Challenge: Cumulative Sales by Region
Oppgave
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, andamountfrom thesalestable. - Calculate a cumulative sum of the
amountcolumn for eachregion, ordered bysale_dateand then bysale_id. - Name the cumulative sum column
cumulative_sales. - Partition the calculation by
region. - Order the final results by
region, then bysale_date, and then bysale_id.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 7
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 the main benefits or drawbacks?
Can you give me a real-world example?
Fantastisk!
Completion rate forbedret til 4.55
Challenge: Cumulative Sales by Region
Sveip for å vise menyen
Oppgave
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, andamountfrom thesalestable. - Calculate a cumulative sum of the
amountcolumn for eachregion, ordered bysale_dateand then bysale_id. - Name the cumulative sum column
cumulative_sales. - Partition the calculation by
region. - Order the final results by
region, then bysale_date, and then bysale_id.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 7
single