GROUP BY and Null Values

If the grouping column contains a null value, that row becomes a group in the results. If the grouping column contains more than one null value, the null values are put into a single group.

The royalty column in the titles table contains some null values. Here's an example that uses GROUP BY and the royalty column:

SELECT royalty, AVG(price * 2)
FROM titles
GROUP BY royalty



royalty


-------
------

(null)
(null)

10
53.88

12
63.79

14
23.90

16
45.90

24
14.95




(6 row(s) affected)