Skip to content

Practice List the Products Ordered in a Period

Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.

Easy#1327
LeetCode Problem

List the Products Ordered in a Period

Problem Statement

Tables: Products(product_id INT, product_name VARCHAR, product_category VARCHAR); Orders(product_id INT, order_date DATE, unit INT). Products.product_id is unique. Orders permits duplicates; its product_id references Products and unit is the quantity ordered. Return product_name and unit for products with at least 100 units ordered during February 2020. Sum units only within that calendar month, including February 29. Output order is unrestricted.

Source: List the Products Ordered in a Period on LeetCode. Use the original task for its coding environment and submissions.

Examples

# Example 1

Input
Products table: +-------------+-----------------------+------------------+ | product_id  | product_name          | product_category | +-------------+-----------------------+------------------+ | 1           | Leetcode Solutions    | Book             | | 2           | Jewels of Stringology | Book             | | 3           | HP                    | Laptop           | | 4           | Lenovo                | Laptop           | | 5           | Leetcode Kit          | T-shirt          | +-------------+-----------------------+------------------+ Orders table: +--------------+--------------+----------+ | product_id   | order_date   | unit     | +--------------+--------------+----------+ | 1            | 2020-02-05   | 60       | | 1            | 2020-02-10   | 70       | | 2            | 2020-01-18   | 30       | | 2            | 2020-02-11   | 80       | | 3            | 2020-02-17   | 2        | | 3            | 2020-02-24   | 3        | | 4            | 2020-03-01   | 20       | | 4            | 2020-03-04   | 30       | | 4            | 2020-03-04   | 60       | | 5            | 2020-02-25   | 50       | | 5            | 2020-02-27   | 50       | | 5            | 2020-03-01   | 50       | +--------------+--------------+----------+
Output
+--------------------+---------+ | product_name       | unit    | +--------------------+---------+ | Leetcode Solutions | 130     | | Leetcode Kit       | 100     | +--------------------+---------+

Related LeetCode Problems

Practice more problems similar to List the Products Ordered in a Period.

Review your practice with PhantomCodeAI

After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.