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

bookChallenge: Calculate Running Totals

Compito

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.

Soluzione

Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 4
single

single

Chieda ad AI

expand

Chieda ad AI

ChatGPT

Chieda pure quello che desidera o provi una delle domande suggerite per iniziare la nostra conversazione

Suggested prompts:

Can you explain this in simpler terms?

What are the main points I should remember?

Can you give me an example?

close

bookChallenge: Calculate Running Totals

Scorri per mostrare il menu

Compito

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.

Soluzione

Switch to desktopCambia al desktop per esercitarti nel mondo realeContinua da dove ti trovi utilizzando una delle opzioni seguenti
Tutto è chiaro?

Come possiamo migliorarlo?

Grazie per i tuoi commenti!

Sezione 1. Capitolo 4
single

single

some-alt