You're looking for GROUP BY. Something like this: SELECT first_name, COUNT(first_name) GROUP BY first_name;