1SELECT
2 p.id,
3 p.name,
4 SUM(oi.quantity * oi.unit_price) AS total_sold
5FROM products p
6INNER JOIN order_items oi ON oi.product_id = p.id
7GROUP BY p.id, p.name
8ORDER BY total_sold DESC;
9-- Products with no sales are missing from results
no lines flagged
#003PracticeMedium15 min · 120 XP
Wrong JOIN Type Loses Data
A report of all products and their sales totals silently drops products with zero sales. Find the architectural fault.
Flagged linesNo lines flagged yet
What's wrong?
Flag a line or write a note to submit.