Skip to main content
All Problems
medium0% acceptance

Product Profit Margins

Calculate the profit margin for each product as (price - cost) / price * 100. Return the product name, price, cost, and margin rounded to 1 decimal place. Sort by margin descending. Only include products with a positive margin.

Schema

🔑idINT
nameTEXT
🔗category_idINT
priceREAL
costREAL
stock_quantityINT
created_atTIMESTAMP
postgresql

Run your query to see results

Press Ctrl + Enter to execute