|< < 28 > >|

Aggregation

Average

The avg function can be used to average columns.

Same rules as for counting values:

  • avg(x) averages non-null values of x.
  • avg(distinct x) averages distinct non-null values of x. (Sum of distinct non-null values divided by the count of distinct non-null values.)

Data
select avg(y) from t22.6
select avg(distinct y) from t20.75

|< < 28 > >|