db.avg
Average a numeric column across matching rows, in SQL.
Averages one numeric column in SQL and returns null over an empty set rather than 0, so a missing average stays distinct from a real zero. Filter first, then average the query.
Parameters
accessor
(row) => number
RequiredThe numeric column to average.
Average a column
const avgScore = await Answers.avg((a) => a.score); // number | null