# Table functions

A table function appears in FROM and supplies rows with a documented schema. It can be filtered, joined or aggregated like another query source.

## Sources

| Source                                                                                                  | Use                                                    |
| ------------------------------------------------------------------------------------------------------- | ------------------------------------------------------ |
| [`generate_series`](https://coordinatordb.com/docs/reference/functions/table-functions/generate-series) | Generate inclusive numeric or calendar values.         |
| [`file`](https://coordinatordb.com/docs/reference/functions/table-functions/file)                       | Read a confined server-side file with an input format. |
| `unnest`, `generate_subscripts`                                                                         | Expand arrays or enumerate their positions.            |
| `string_to_table`, `regexp_split_to_table`                                                              | Split text into rows.                                  |
| `regexp_matches`                                                                                        | Return regular-expression matches as rows.             |
| `json_each`, `json_tree` and JSON/JSONB expanders                                                       | Read JSON members, paths or typed records as rows.     |

The [array](https://coordinatordb.com/docs/reference/functions/regular-functions/array-functions), [JSON](https://coordinatordb.com/docs/reference/functions/regular-functions/json-functions), [splitting](https://coordinatordb.com/docs/reference/functions/regular-functions/splitting-merging-functions) and [search](https://coordinatordb.com/docs/reference/functions/regular-functions/string-search-functions) references specify their arguments and output columns. Typed JSON record sources can require an `AS alias(column Type, ...)` schema.

## Example

### Aggregating generated rows

```sql
SELECT count(*) AS rows, sum(generate_series) AS total
FROM generate_series(1, 5)
FORMAT csv;
```

```text
5,15
```

Use the documented FROM form. A function returning rows is not interchangeable with a scalar function returning an Array or JSON value.
