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.
Рішення
Дякуємо за ваш відгук!
single
Запитати АІ
Запитати АІ
Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат
Can you explain this in simpler terms?
What are the main benefits or drawbacks?
Can you give me a real-world example?
Чудово!
Completion показник покращився до 4.55
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.
Рішення
Дякуємо за ваш відгук!
single