SELECT name,COUNT(*) FROM tablename GROUP BY name ORDER BY COUNT(*) DESC;
Here is what the above code is Doing:
1. We’re selecting the name column and the count of the number of times that name appears in the table.
2. We’re grouping the results by name.
3. We’re ordering the results by the count in descending order.