Find the total value of all transactions for each day.


Find the total value of all transactions for each day.

Given a table of transactions, this SQL query will find the total value of all transactions that occurred on each day.

Problem

Given a table of transactions, write a SQL query to find the total value of all transactions that occurred on each day.
Example input:
transaction_id | value | date
1 | 10 | 2020-01-01
2 | 20 | 2020-01-02
3 | 30 | 2020-01-02
4 | 40 | 2020-01-03
Example output:
date | total_value
2020-01-01 | 10
2020-01-02 | 50
2020-01-03 | 40

Solution

by AskAI
SELECT date, SUM(value) AS total_value
FROM transactions
GROUP BY date;

A.I. Evaluation of the Solution

The candidate's solution is correct and solves the problem. The approach is straightforward and easy to understand.

Evaluated at: 2022-10-18 13:31:59