Challenge: Calculate Running Total of Sales
Oppgave
Swipe to start coding
Write a query to calculate the running total of sales amount for each employee, ordered by sale_date.
- For each row in the
salestable, calculate a running total of theamountfor the sameemployee_id. - The running total should be ordered by
sale_date. If two sales have the same date for the same employee, usesale_idto break ties. - The output should include columns:
sale_id,sale_date,employee_id,amount, and the calculated running total asrunning_total. - The results should be ordered by
employee_id, then bysale_date, then bysale_id.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
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 points I should remember?
Can you give me an example?
Fantastisk!
Completion rate forbedret til 4.55
Challenge: Calculate Running Total of Sales
Sveip for å vise menyen
Oppgave
Swipe to start coding
Write a query to calculate the running total of sales amount for each employee, ordered by sale_date.
- For each row in the
salestable, calculate a running total of theamountfor the sameemployee_id. - The running total should be ordered by
sale_date. If two sales have the same date for the same employee, usesale_idto break ties. - The output should include columns:
sale_id,sale_date,employee_id,amount, and the calculated running total asrunning_total. - The results should be ordered by
employee_id, then bysale_date, then bysale_id.
Løsning
Alt var klart?
Takk for tilbakemeldingene dine!
Seksjon 1. Kapittel 2
single