Easiest Solution ~
Intuition\nWe need to report Product IDs exclusively sold in first quarter 2019. So if a product is sold in first quarter and also in later or prior then it sho
# Intuition\nWe need to report Product IDs exclusively sold in first quarter 2019. So if a product is sold in first quarter and also in later or prior then it should not be reported.\n\n# Approach\nSince the output has product name, product id and sale date we join Product and Sales table. \nNext we check for 2 conditions \n    a) Product has been sold between dates \'2019-01-01\' and \'2019-03-31\'\n    b) Product has not been sold outside above range\n\n# Code\n```\n# Write your MySQL query statement below\n\nselect s.product_id product_id,p.product_name product_name from Sales s join Product p on s.product_id = p.product_id\n where s.Sale_date between \'2019-01-01\' and \'2019-03-31\'\n and s.product_id not in (select product_id from Sales where Sale_date > \'2019-03-31\' or Sale_date < \'2019-01-01\' )\n group by 1,2\n\n```
['MySQL']