Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Leer Challenge: Calculate Running Totals | Time-Series Aggregation
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL for Finance and Accounting

bookChallenge: Calculate Running Totals

Taak

Swipe to start coding

Write a SQL query to calculate the running total of expenses over time, using the transactions table. Only include rows where the category is 'Expense'. The results must be ordered by transaction_date. For each row, return the transaction_date, amount, description, and a column named running_total that is the sum of all amount values for expenses from the earliest to the current row (inclusive), ordered by date.

  • Filter the transactions table to include only rows where category is 'Expense'.
  • Select the transaction_date, amount, and description columns.
  • Calculate a running total of amount for each row, ordered by transaction_date, and include it as running_total.
  • Order the results by transaction_date.

Oplossing

Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
single

single

Vraag AI

expand

Vraag AI

ChatGPT

Vraag wat u wilt of probeer een van de voorgestelde vragen om onze chat te starten.

close

bookChallenge: Calculate Running Totals

Veeg om het menu te tonen

Taak

Swipe to start coding

Write a SQL query to calculate the running total of expenses over time, using the transactions table. Only include rows where the category is 'Expense'. The results must be ordered by transaction_date. For each row, return the transaction_date, amount, description, and a column named running_total that is the sum of all amount values for expenses from the earliest to the current row (inclusive), ordered by date.

  • Filter the transactions table to include only rows where category is 'Expense'.
  • Select the transaction_date, amount, and description columns.
  • Calculate a running total of amount for each row, ordered by transaction_date, and include it as running_total.
  • Order the results by transaction_date.

Oplossing

Switch to desktopSchakel over naar desktop voor praktijkervaringGa verder vanaf waar je bent met een van de onderstaande opties
Was alles duidelijk?

Hoe kunnen we het verbeteren?

Bedankt voor je feedback!

Sectie 1. Hoofdstuk 4
single

single

some-alt