✅✅ EXPLAINED MySQL || JOINS && HAVING && GROUP BY
\n\n# So this command will give wrong answer because as there are duplicate\n#in the sales table therefore if you see in example acc. to this query ,  G4 will\n
```\n\n# So this command will give wrong answer because as there are duplicate\n#in the sales table therefore if you see in example acc. to this query ,  G4 will\n#also be printed because it has been bought in the spring  but if you see it is \n#also been bought after the spring therefore we  have to use group by so that \n#we get onlt those products that have only been bought in the spring\n\n# SELECT s.product_id, p.product_name \n#FROM Product AS p INNER JOIN Sales AS s\n#ON  s.product_id=p.product_id \n#WHERE s.sale_date >= \'2019-01-01\' AND  s.sale_date <=\'2019-03-31\';\n\n\n#*************************************************************************************\n\n\n# therefore we will group on the basis of product ID and we will then check\n#what are the minimum and maximum sale date for each product and \n#thereofore if that product sale is in spring\n\nSELECT p.product_id, p.product_name \nFROM Product AS p INNER JOIN Sales AS s \nON  s.product_id=p.product_id \nGROUP BY s.product_id \nHAVING MIN(s.sale_date)>=\'2019-01-01\' AND  MAX(s.sale_date) <=\'2019-03-31\';\n```
[]