Daily sales report
SQL
Medium
2 views
Problem Description
Make a simple daily sales report for the last 7 days. From Orders(order_date, total_amount), show order_date and total sales per day.
Sample Test Case
Input:
Orders(order_date, total_amount)
Constraints
Assume PostgreSQL-style interval
Official Solution
SELECT order_date, SUM(total_amount) AS total_sales FROM Orders WHERE order_date >= (CURRENT_DATE - INTERVAL '7 days') GROUP BY order_date ORDER BY order_date;
Solutions (0)
No solutions submitted yet. Be the first!
No comments yet. Start the discussion!