Group by returns wrong products
Review this SQL meant to show each product's latest price and total units sold.
This runs on MySQL with `ONLY_FULL_GROUP_BY` disabled.
What a strong answer looks like
Separate real bugs from style. Rank issues by severity, point at the root cause rather than the symptom, and suggest a concrete fix, specific and kind.
0:00 of about 24 min
Mark a line and say what kind of problem it is.0 findings
1SELECT p.category,
2 p.name,
3 p.price,
4 SUM(s.units) AS units_sold
5FROM products p
6JOIN sales s ON s.product_id = p.id
7GROUP BY p.category;
Which questions mattered is sealed until you submit. Telling you now would just be handing over the edge cases.
Run or narrate your approach, then ask the coach.