GROUP BY clause groups rows by some value:
SELECT type, count(*) as c
FROM sys.objects
GROUP BY type
You can apply some function on each group (aggregate function) to calculate sum or count of the records in the group.
| type | c |
|---|---|
| SQ | 3 |
| S | 72 |
| IT | 16 |
| PK | 1 |
| U | 5 |