Null (SQL) - Aggregate Functions

Aggregate Functions

SQL defines aggregate functions to simplify server-side aggregate calculations on data. Except for the COUNT(*) function, all aggregate functions perform a Null-elimination step, so that Null values are not included in the final result of the calculation.

Note that the elimination of Null values is not equivalent to replacing those values with zero. For example, in the following table, AVG(i) (the average of the values of i) will give a different result from that of AVG(j):

Table
i j
150 150
200 200
250 250
NULL 0

Here AVG(i) is 200 (the average of 150, 200, and 250), while AVG(j) is 150 (the average of 150, 200, 250, and 0). A well-known side effect of this is that in SQL AVG(z) is not equivalent with SUM(z)/COUNT(*).

Read more about this topic:  Null (SQL)

Famous quotes containing the words aggregate and/or functions:

    The aggregate of all knowledge has not yet become culture in us. Rather it would seem as if, with the progressive scientific penetration and dissection of reality, the foundations of our thinking grow ever more precarious and unstable.
    Johan Huizinga (1872–1945)

    The English masses are lovable: they are kind, decent, tolerant, practical and not stupid. The tragedy is that there are too many of them, and that they are aimless, having outgrown the servile functions for which they were encouraged to multiply. One day these huge crowds will have to seize power because there will be nothing else for them to do, and yet they neither demand power nor are ready to make use of it; they will learn only to be bored in a new way.
    Cyril Connolly (1903–1974)