Problem Description –
Write an SQL query to get the names of products that have at least 100
units ordered in February 2020 and their amount.
Return result table in any order.
The query result format is in the following example.


Difficulty Level – Easy
Problem Link – Products Ordered
Solution –
SELECT
t2.product_name,
t1.unit
FROM (
SELECT
product_id,
SUM(unit) as unit
FROM Orders
WHERE DATE_FORMAT(order_date, '%Y-%m') = '2020-02'
GROUP BY 1
HAVING SUM(unit) >= 100
) as t1 JOIN Products as t2
ON t1.product_id = t2.product_id