Challenge: Quarterly Expense Report
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
transactionstable to include only those wherecategoryis'Expense'. - Group the filtered rows by quarter, using the
transaction_dateto determine the quarter and year. - Calculate the sum of the
amountfor each quarter. - Return the quarter (in the format
YYYY-Qn) and the total expenses for that quarter.
Lösung
Danke für Ihr Feedback!
single
Fragen Sie AI
Fragen Sie AI
Fragen Sie alles oder probieren Sie eine der vorgeschlagenen Fragen, um unser Gespräch zu beginnen
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Großartig!
Completion Rate verbessert auf 4.55
Challenge: Quarterly Expense Report
Swipe um das Menü anzuzeigen
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
transactionstable to include only those wherecategoryis'Expense'. - Group the filtered rows by quarter, using the
transaction_dateto determine the quarter and year. - Calculate the sum of the
amountfor each quarter. - Return the quarter (in the format
YYYY-Qn) and the total expenses for that quarter.
Lösung
Danke für Ihr Feedback!
single