1174. Sales Analysis III
My accepted SQL solution to LeetCode problem 1174, Sales Analysis III, running in 967ms.
- Difficulty: Easy
- SQL
- Runtime 967ms
- Memory 0.0B
- Updated
Read the problem on LeetCode View on GitHub
The problem statement is LeetCode’s and stays on their site. What follows is my accepted solution.
SQL
Accepted on LeetCode — runtime 967ms, memory 0.0B, accepted 2025-12-29.
SELECT p.product_id, p.product_name
FROM Product p
JOIN Sales s ON p.product_id = s.product_id
GROUP BY p.product_id, p.product_name
HAVING MIN(s.sale_date) >= '2019-01-01' AND MAX(s.sale_date) <= '2019-03-31'