SQL Group By

What
SQL group by allows us to choose which groups we're interested in applying queries on

Format
SELECT [DISTINCT] target-list FROM relation-list [WHERE qualifications] GROUP BY grouping-list There are some restrictions when using group by
 * The target-list can only contain terms with aggregation functions on them and terms that are in the grouping-list

Example
The following query finds the average age of sailors for each rating SELECT s.rating, AVG(s.age) FROM Sailors s GROUP BY s.rating