SELECT DISTINCT col FROM t and SELECT col FROM t GROUP BY col return the same rows. So why prefer one?
DISTINCT is for de-duping projection
Use DISTINCT when you have no aggregates and you genuinely want unique tuples of the projected columns. It is shorter and clearer for that case.
GROUP BY is for aggregation
The moment you add COUNT, SUM, or any aggregate, you must use GROUP BY. DISTINCT cannot express 'group these and aggregate those' in one step.
Why DISTINCT often hides bugs
DISTINCT silently masks fan-out joins. The row count looks reasonable because duplicates were collapsed — but the bug is still there, ready to surface when someone adds an aggregate later.
-- Looks fine, but if order_items fans out, DISTINCT hides it.
SELECT DISTINCT o.order_id, o.customer_id
FROM orders o JOIN order_items i ON i.order_id = o.order_id;If you reach for DISTINCT to fix duplicates, stop and inspect the join lineage first. DISTINCT is the symptom, not the fix.