AVG
Represents the SQL AVG() aggregate function.
This function returns the average value of all non-NULL values in a group. The result of AVG() is always a floating-point value (Double).
Example
// SELECT AVG(salary) FROM Employees;
val cursor =
select(AVG(Tracks.length))
.from(Employees)
.execute()
println(cursor[AVG(Tracks.length)])
cursor.close()
// SELECT AVG(DISTINCT salary) FROM Employees;
val cursor =
Employees
.select(AVG(Tracks.length), distinct = true)
.execute()
println(cursor[AVG(Tracks.length)])
cursor.close()Content copied to clipboard
Return
A KQLiteColumn representing the average value, which is always of type Double.
Author
MOHAMMAD AZIM ANSARI
Parameters
column
The column to calculate the average from.
distinct
If true, only DISTINCT values in the column are considered. Defaults to false.