Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Lære Challenge: Quarterly Expense Report | Time-Series Aggregation
Practice
Projects
Quizzes & Challenges
Quizzes
Challenges
/
SQL for Finance and Accounting

bookChallenge: Quarterly Expense Report

Opgave

Swipe to start coding

Write a SQL query to calculate the total expenses for each quarter using the transactions table. Only include rows where the category is 'Expense'. Aggregate the amount by quarter, grouping the results by quarter.

  • Filter the rows in the transactions table to include only those where category is 'Expense'.
  • Group the filtered rows by quarter, using the transaction_date to determine the quarter and year.
  • Calculate the sum of the amount for each quarter.
  • Return the quarter (in the format YYYY-Qn) and the total expenses for that quarter.

Løsning

Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 6
single

single

Spørg AI

expand

Spørg AI

ChatGPT

Spørg om hvad som helst eller prøv et af de foreslåede spørgsmål for at starte vores chat

Suggested prompts:

Can you explain this in simpler terms?

What are the main benefits or drawbacks?

Can you give me a real-world example?

close

bookChallenge: Quarterly Expense Report

Stryg for at vise menuen

Opgave

Swipe to start coding

Write a SQL query to calculate the total expenses for each quarter using the transactions table. Only include rows where the category is 'Expense'. Aggregate the amount by quarter, grouping the results by quarter.

  • Filter the rows in the transactions table to include only those where category is 'Expense'.
  • Group the filtered rows by quarter, using the transaction_date to determine the quarter and year.
  • Calculate the sum of the amount for each quarter.
  • Return the quarter (in the format YYYY-Qn) and the total expenses for that quarter.

Løsning

Switch to desktopSkift til skrivebord for at øve i den virkelige verdenFortsæt der, hvor du er, med en af nedenstående muligheder
Var alt klart?

Hvordan kan vi forbedre det?

Tak for dine kommentarer!

Sektion 1. Kapitel 6
single

single

some-alt