Challenge: Calculate Running Total of Sales
Opgave
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
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 2
single
Spørg AI
Spørg AI
Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat
Fantastisk!
Completion rate forbedret til 4.55
Challenge: Calculate Running Total of Sales
Stryg for at vise menuen
Opgave
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
Var alt klart?
Tak for dine kommentarer!
Sektion 1. Kapitel 2
single