aggregate
Calculates count, sum, avg, min, or max over a table or view with optional filters and grouping, returning at most 1,000 groups.
Instructions
Computes count, sum, avg, min or max over one table or view, with an optional filter and grouping. Returns at most 1,000 groups.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| table | Yes | The table or view to aggregate, by exact name. | |
| where | No | Conditions joined by AND. Omit to aggregate every row. | |
| column | No | The column to aggregate. Required except for count, which counts rows without it. | |
| schema | No | The schema, by exact name. Defaults to public. | |
| database | Yes | The database to run on. | |
| function | Yes | The aggregate function. | |
| group_by | No | Columns to group and order by. Omit for one row. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | The result rows, each an array in column order. | |
| columns | Yes | The result columns, in order. | |
| truncated | Yes | True when the row cap, the byte cap or limit cut off more rows. |