Databases · Junior · Question 29 of 75
Why does SELECT city, name, COUNT(*) FROM users GROUP BY city fail?
- 1You can't group by text columns
- ✓Correct answer:
nameis neither grouped nor aggregated, so there is no single value per city - 3
COUNT(*)can't be used withGROUP BY
Explanation
Each output row is a group. Every selected column must be in GROUP BY or wrapped in an aggregate like MAX(name) or string_agg(name, ', ').