From bf1f8ecb9ec109365d086ded700c1e5128bec9ad Mon Sep 17 00:00:00 2001 From: Soeren Wolfers Date: Mon, 25 Aug 2025 12:27:32 +0100 Subject: [PATCH 1/2] Update from.md --- docs/preview/sql/query_syntax/from.md | 29 +++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/docs/preview/sql/query_syntax/from.md b/docs/preview/sql/query_syntax/from.md index 9ddfc3f738b..0ebe431a0ad 100644 --- a/docs/preview/sql/query_syntax/from.md +++ b/docs/preview/sql/query_syntax/from.md @@ -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. From a1bbb8a8a505652bdd8e98432707eedeb21b6d31 Mon Sep 17 00:00:00 2001 From: Gabor Szarnyas Date: Mon, 15 Sep 2025 10:11:36 +0200 Subject: [PATCH 2/2] nits --- docs/preview/sql/query_syntax/from.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/docs/preview/sql/query_syntax/from.md b/docs/preview/sql/query_syntax/from.md index 0ebe431a0ad..b90123ee5c4 100644 --- a/docs/preview/sql/query_syntax/from.md +++ b/docs/preview/sql/query_syntax/from.md @@ -119,12 +119,11 @@ SELECT sum(t.i) WHERE i % 2 = 0; ``` -### Table functions +### 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'; @@ -147,7 +146,6 @@ 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.