Practice Sales Analysis III
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
Tables: Product(product_id INT, product_name VARCHAR, unit_price INT); Sales(seller_id INT, product_id INT, buyer_id INT, sale_date DATE, quantity INT, price INT). Product.product_id is unique. Sales may have duplicate rows and references Product through product_id. Return product_id and product_name for products with at least one sale whose sales all occurred from 2019-01-01 through 2019-03-31 inclusive. A sale outside that interval disqualifies the product. Output order is unrestricted.
Source: Sales Analysis III on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Product table: +------------+--------------+------------+ | product_id | product_name | unit_price | +------------+--------------+------------+ | 1 | S8 | 1000 | | 2 | G4 | 800 | | 3 | iPhone | 1400 | +------------+--------------+------------+ Sales table: +-----------+------------+----------+------------+----------+-------+ | seller_id | product_id | buyer_id | sale_date | quantity | price | +-----------+------------+----------+------------+----------+-------+ | 1 | 1 | 1 | 2019-01-21 | 2 | 2000 | | 1 | 2 | 2 | 2019-02-17 | 1 | 800 | | 2 | 2 | 3 | 2019-06-02 | 1 | 800 | | 3 | 3 | 4 | 2019-05-13 | 2 | 2800 | +-----------+------------+----------+------------+----------+-------+
+-------------+--------------+ | product_id | product_name | +-------------+--------------+ | 1 | S8 | +-------------+--------------+
Related LeetCode Problems
Practice more problems similar to Sales Analysis III.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.