bugfree Icon
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course
interview-course

Leetcode Problem 1084. Sales Analysis III

1084. Sales Analysis III

Leetcode Solutions

Identifying Products Sold Exclusively in Q

  1. Join the Product and Sales tables on product_id.
  2. Group the results by product_id.
  3. Use the HAVING clause to ensure that the minimum sale_date is greater than or equal to 2019-01-01 and the maximum sale_date is less than or equal to 2019-03-31.
  4. Select the distinct product_id and product_name from the filtered results.
erDiagram
    Product {
        int product_id PK
        varchar product_name
        int unit_price
    }
    Sales {
        int seller_id
        int product_id FK
        int buyer_id
        date sale_date
        int quantity
        int price
    }
    Product ||--o{ Sales : contains

Filtering Products by Exclusive Sale Dates Using Subqueries

Ask Question

Programming Language
image/screenshot of info(optional)
Full Screen
Loading...

Suggested Answer

Answer
Full Screen
Copy Answer Code
Loading...