> For the complete documentation index, see [llms.txt](https://docs.daita.ch/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.daita.ch/usage/relational/functions/aggregation/avg.md).

# AVG

```typescript
const stats = await client.select({
   select: {
       height: avg(Moutain, 'height'),
       country: field(Mountain, 'country'),
   }
   from: table(Mountain),
   groupBy: field(Mountain, 'country'),
});
// sql: SELECT avg("Mountain"."height"), "Mountain"."country"
//      FROM "Mountain"
//      GROUP BY "Mountain"."country"
//
// const stats: { height: number, country: string }[]
```
