LeetCode solutions

1462. List the Products Ordered in a Period

My accepted SQL solution to LeetCode problem 1462, List the Products Ordered in a Period, running in 638ms.

  • Difficulty: Easy
  • SQL
  • Runtime 638ms
  • Memory 0.0B

Read the problem on LeetCode View on GitHub

SQL

Accepted on LeetCode — runtime 638ms, memory 0.0B, accepted 2025-12-31.

sql
SELECT p.product_name, SUM(o.unit) AS unit
FROM Products p
JOIN Orders o ON p.product_id = o.product_id
WHERE o.order_date BETWEEN '2020-02-01' AND '2020-02-29'
GROUP BY p.product_id
HAVING SUM(o.unit) >= 100

Source