Databases · Junior · Question 29 of 75

Why does SELECT city, name, COUNT(*) FROM users GROUP BY city fail?

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, ', ').

Further reading

Problem with a question

Databases · Junior · question 29

Test yourself

Take the Databases · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz