Skip to content

3293. Calculate Product Final Price 👍

1
2
3
4
5
6
7
8
9
SELECT
  Products.product_id,
  Products.price - (
    Products.price * IFNULL(Discounts.discount, 0) / 100
  ) AS final_price,
  Products.category
FROM Products
LEFT JOIN Discounts
  USING (category);