avg method

QuerySingle<(Expr<double?>)> avg()

Take the average of the rows in this query using the AVG aggregate function.

This is equivalent to SELECT AVG(column1) FROM this in SQL.

Note

Like the AVG aggregate function in SQL, this method will return NULL if there are no rows, or if all rows are NULL. Similarly, NULL rows will not figure in the average value.

Implementation

QuerySingle<(Expr<double?>,)> avg() =>
    select((a) => (AvgExpression._(a),)).first;