My issue
SELECT
dp.product_type,
dp.product_id,
ms.sold_units, – Assuming the correct column name is ‘sold_units’
dp.month
FROM
division_product_sales dp
JOIN
monthly_sales ms
ON dp.month = ms.month
WHERE
dp.margin_status = ‘High_Margin’ – Filter for high margin products
ORDER BY
dp.month, dp.product_type, dp.product_id;
DESCRIBE monthly_sales;
My code
SELECT
dps.product_type,
dps.product_id,
ms.units_sold,
TO_CHAR(ms.month, 'Mon') AS month
FROM
division_product_sales dps
JOIN
monthly_sales ms
ON
dps.month = ms.month
WHERE
dps.product_margin = 'High_Margin'
AND EXTRACT(YEAR from ms.month) = EXTRACT(YEAR from CURRENT_DATE)
ORDER BY
ms.month, dps.product_type, dps.product_id;
Learning course: Database management systems
Problem Link: Project - JOIN and Filtering in Database management systems