Databases

Table of Contents

Aggregations

A view declaration registers a query (not the result) under an identifier

Simple aggregation functions: COUNT, SUM, AVG, MAX, MIN

Restrictions:

Null values and aggregations

GROUP BY partitions tuples of a table into groups, based on value equality for the GROUP BY attributes. It can never produce empty groups. Aggregation functions are applied to groups separately. Sequence of GROUP BY is not important.

HAVING is a way to filter out groups based on some property. E.g. HAVING SUM(POINTS) >= 18. HAVING should only contain aggregation functions, not single attributes.