Summarising data

So far a query lists individual rows. An aggregate combines many rows into a single value.

The five common aggregates: count, sum, avg, min, max.

You write one as an argument in a rule head. Used alone, an aggregate summarises the whole relation into one number.

First example (next): a single global number. We add grouping right after.