SQL MOSAIC # 1084. Sales Analysis III
Date: 7.02.2022
Write an SQL query that reports the products that were only sold in the first quarter of 2019. That is, between 2019–01–01 and 2019–03–31 inclusive.
Return the result table in any order.

Thinking Pathway:
- Filter for 2019 Q1
- TRICK: this question needs us to filter for products that were sold ONLY in Q1. So, we will need to filter for products that were sold in Q1 AND NOT in the other quarters.
Solution(s):
SELECT DISTINCT p.product_id, p.product_name
FROM Product p JOIN Sales s ON p.product_id = s.product_id
WHERE s.product_id NOT IN
(SELECT product_id
FROM Sales
WHERE sale_date NOT BETWEEN ‘2019–01–01’ AND ‘2019–03–31’)