Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions docs/preview/sql/query_syntax/from.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,35 @@ SELECT sum(t.i)
WHERE i % 2 = 0;
```

### Table functions

Some functions in duckdb return entire tables rather than individual values. These functions are accordingly called _table functions_ and can be used with a `FROM` clause like regular table references.
Examples include `read_csv`, `read_parquet`, `range`, `generate_series`, `repeat`, `unnest`, `glob`. For example, the previous example


```sql
SELECT *
FROM 'test.csv';
```

is implicitly translated to


```sql
SELECT *
FROM read_csv('test.csv');
```

All table functions support a `WITH ORDINALITY` prefix, which extends the returned table by an integer column `ordinality` that enumerates the generated rows starting at `1`.

```sql
SELECT *
FROM read_csv('test.csv') WITH ORDINALITY;
```

Note that the same result could be achieved using the `row_number` window function.


## Joins

Joins are a fundamental relational operation used to connect two tables or relations horizontally.
Expand Down