Problem Description –
Write an SQL query that reports the products that were only sold in the first quarter of
2019. That is, between
Return the result table in any order.
The query result format is in the following example.
Difficulty Level – Easy
Problem Link – https://leetcode.com/problems/sales-analysis-iii/
SELECT DISTINCT product_id, product_name FROM ( SELECT s.product_id, p.product_name FROM sales as s JOIN product as p ON s.product_id = p.product_id ) x WHERE product_id NOT IN ( SELECT product_id FROM sales WHERE sale_date NOT BETWEEN '2019-01-01' AND '2019-03-31' )