My issue
SELECT
d.product_type,
d.product_id,
d.units_sold,
s.month
FROM
division_product_sales d
JOIN
monthly_sales s
ON
d.month = s.month
WHERE
d.product_type = ‘High_Margin’
ORDER BY
s.month;
This is the approach I have used but it says wrong answer and failed on a hidden test case
My code
SELECT
d.product_type, -- Selecting the product type
d.product_id, -- Selecting the product ID
d.units_sold, -- Selecting the number of units sold
s.month -- Selecting the month of sales
FROM
division_product_sales d -- From the division_product_sales table (aliased as d)
JOIN
monthly_sales s -- Joining with the monthly_sales table (aliased as s)
ON
d.month = s.month -- The join condition on the 'month' column
WHERE
d.product_type = 'High_Margin' -- Filter for 'High_Margin' products
ORDER BY
s.month; -- Order by month to ensure chronological order
Learning course: Database management systems
Problem Link: Project - JOIN and Filtering in Database management systems