My issue
output format has not been mentioned and any solution is concluded wrong
My code
/* Write a query to perform the following
- Join the tables - 'product_catalog' and division_product_sales'
- Output product_id, units_sold and month from the joined table
- Remember the condition - we need to identify the worst performing month for each product_id in terms of units sold
- Order by product_id */
SELECT pc.product_id, MIN(dsp.units_sold) AS min_sold, dsp.month
FROM product_catalog pc
JOIN division_product_sales dsp
ON pc.product_id = dsp.product_id
GROUP BY pc.product_id, dsp.month
ORDER BY pc.product_id;
Learning course: Learn Data Analytics using SQL and Python
Problem Link: Practice Problem in - CodeChef