Code Room
Code reviewHardcr-g646
Subject Sql group byLevel Mid–Senior~24 minCommon in Databases & SQL interviewsIndustries Software development

Question

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.

Talk through your review
Code to reviewsql
SELECT p.category,       p.name,       p.price,       SUM(s.units) AS units_soldFROM products pJOIN sales s ON s.product_id = p.idGROUP BY p.category;
Run or narrate your approach, then ask the coach.