👉🏻EASY TO UNDERSTAND SOLUTION || LEFT JOIN, GROUP BY, IFNULL(), ROUND(), SUM() || MySQL
IntuitionApproachComplexity
Time complexity:

Space complexity:
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity:
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity:
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```mysql []
SELECT p.product_id,IFNULL(ROUND(SUM(price*units)/SUM(units),2),0) AS average_price
FROM Prices as p LEFT JOIN UnitsSold as u
ON p.product_id=u.product_id
AND u.purchase_date BETWEEN start_date AND end_date 
GROUP BY product_id
```
['MySQL']