INNER JOIN Solution of list the products ordered in a period
Approach\n- The SUM() function returns the total sum of a numeric column.\n- The INNER JOIN keyword selects records that have matching values in both tables.\n-
## Approach\n- The `SUM()` function returns the total sum of a numeric column.\n- The `INNER JOIN` keyword selects records that have matching values in both tables.\n- The `WHERE` clause is used to filter records.\n- The `MONTH()` function returns the month part for a specified date (a number from 1 to 12).\n- The `YEAR()` function returns the year part for a given date (a number from 1000 to 9999).\n- The `GROUP BY` statement groups rows that have the same values into summary rows\n- The `HAVING` clause was added to SQL because the WHERE keyword cannot be used with aggregate functions.\n\n# Code\n```\nSELECT product_name, SUM(unit) AS unit\nFROM Orders \nINNER JOIN Products USING(product_id)\nWHERE MONTH(order_date) = \'02\' AND YEAR(order_date) = \'2020\'\nGROUP BY product_id HAVING SUM(unit) >= 100;\n```
['Database', 'MySQL']