PostgreSQL solution with correlated subquery in the FROM clause. Beat 85% of solutions
Intuition\n Describe your first thoughts on how to solve this problem. \nWanted to keep this efficient hence the use of an inline view (the correlated subquery 
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\nWanted to keep this efficient hence the use of an inline view (the correlated subquery in the FROM clause). This has the benefit of then allowing filtering based on values from this table, i.e., units_sold >=100. \n\n# Approach\n<!-- Describe your approach to solving the problem. -->\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```postgresql []\n-- Write your PostgreSQL query statement below\nSELECT product_name, units_sold AS unit\nFROM (\n    SELECT P.product_name, SUM(unit) AS units_sold\n    FROM Orders AS O\n    LEFT JOIN Products AS P\n    ON O.product_id = P.product_id\n    WHERE order_date >= \'2020-02-01\' AND order_date <= \'2020-02-29\'\n    GROUP BY P.product_name\n)\nWHERE units_sold >= 100\n```
['PostgreSQL']