SQL – How to count unique values in database

The following shows how use a simple SQL statement to create a list of unique values and a count of their occurrences from a table.

For example, if we had a table that looked like

Person_ID Person
1 Tim
2 Tom
3 Jim
4 Bob
5 Tim
6 Jim
7 Bob
8 Bob

This SQL statement

SELECT DISTINCT Person,  COUNT(  Person ) AS Count
FROM T_Persons
GROUP BY Person

would return

Person Count
Tim 2
Tom 1
Jim 2
Bob 3