diff --git a/docs/guides/snippets/create_synthetic_data.md b/docs/guides/snippets/create_synthetic_data.md index bfa078ee380..1b6f37f8ce2 100644 --- a/docs/guides/snippets/create_synthetic_data.md +++ b/docs/guides/snippets/create_synthetic_data.md @@ -5,7 +5,7 @@ title: Create Synthetic Data DuckDB allows you to quickly generate synthetic data sets. To do so, you may use: -* [range functions]({% link docs/sql/functions/nested.md %}#range-functions) +* [range functions]({% link docs/sql/functions/list.md %}#range-functions) * hash functions, e.g., [`hash`]({% link docs/sql/functions/utility.md %}#hashvalue), [`md5`]({% link docs/sql/functions/utility.md %}#md5string), diff --git a/docs/sql/data_types/array.md b/docs/sql/data_types/array.md index 8d504a60891..bb397c1ea0f 100644 --- a/docs/sql/data_types/array.md +++ b/docs/sql/data_types/array.md @@ -13,7 +13,7 @@ To store variable-length lists, use the [`LIST` type]({% link docs/sql/data_type ## Creating Arrays -Arrays can be created using the [`array_value(expr, ...)`]({% link docs/sql/functions/nested.md %}#list-functions) function. +Arrays can be created using the [`array_value(expr, ...)` function]({% link docs/sql/functions/array.md %}#array_valueindex). Construct with the `array_value` function: @@ -84,7 +84,7 @@ SELECT id, arr[1:2] AS elements FROM array_table; ## Functions -All [`LIST` functions]({% link docs/sql/functions/nested.md %}#list-functions) work with the `ARRAY` type. Additionally, several `ARRAY`-native functions are also supported. +All [`LIST` functions]({% link docs/sql/functions/list.md %}) work with the `ARRAY` type. Additionally, several `ARRAY`-native functions are also supported. See the [`ARRAY` functions]({% link docs/sql/functions/array.md %}#array-native-functions). ## Examples @@ -120,4 +120,4 @@ The ordering of `ARRAY` instances is defined using a lexicographical order. `NUL ## See Also -For more functions, see [List Functions]({% link docs/sql/functions/nested.md %}#list-functions). +For more functions, see [List Functions]({% link docs/sql/functions/list.md %}). diff --git a/docs/sql/data_types/list.md b/docs/sql/data_types/list.md index af867b1d7ac..a5942158a0f 100644 --- a/docs/sql/data_types/list.md +++ b/docs/sql/data_types/list.md @@ -5,7 +5,7 @@ title: List Type A `LIST` column encodes lists of values. Fields in the column can have values with different lengths, but they must all have the same underlying type. `LIST`s are typically used to store arrays of numbers, but can contain any uniform data type, including other `LIST`s and `STRUCT`s. -`LIST`s are similar to PostgreSQL's `ARRAY` type. DuckDB uses the `LIST` terminology, but some [array functions]({% link docs/sql/functions/nested.md %}#list-functions) are provided for PostgreSQL compatibility. +`LIST`s are similar to PostgreSQL's `ARRAY` type. DuckDB uses the `LIST` terminology, but some [`array_` functions]({% link docs/sql/functions/list.md %}) are provided for PostgreSQL compatibility. See the [data types overview]({% link docs/sql/data_types/overview.md %}) for a comparison between nested data types. @@ -13,7 +13,7 @@ See the [data types overview]({% link docs/sql/data_types/overview.md %}) for a ## Creating Lists -Lists can be created using the [`list_value(expr, ...)`]({% link docs/sql/functions/nested.md %}#list-functions) function or the equivalent bracket notation `[expr, ...]`. The expressions can be constants or arbitrary expressions. To create a list from a table column, use the [`list`]({% link docs/sql/functions/aggregates.md %}#general-aggregate-functions) aggregate function. +Lists can be created using the [`list_value(expr, ...)`]({% link docs/sql/functions/list.md %}#list_valueany-) function or the equivalent bracket notation `[expr, ...]`. The expressions can be constants or arbitrary expressions. To create a list from a table column, use the [`list`]({% link docs/sql/functions/aggregates.md %}#general-aggregate-functions) aggregate function. List of integers: @@ -47,7 +47,7 @@ CREATE TABLE list_table (int_list INTEGER[], varchar_list VARCHAR[]); ## Retrieving from Lists -Retrieving one or more values from a list can be accomplished using brackets and slicing notation, or through [list functions]({% link docs/sql/functions/nested.md %}#list-functions) like `list_extract`. Multiple equivalent functions are provided as aliases for compatibility with systems that refer to lists as arrays. For example, the function `array_slice`. +Retrieving one or more values from a list can be accomplished using brackets and slicing notation, or through [list functions]({% link docs/sql/functions/list.md %}) like `list_extract`. Multiple equivalent functions are provided as aliases for compatibility with systems that refer to lists as arrays. For example, the function `array_slice`. > We wrap the list creation in parenthesis so that it happens first. > This is only needed in our basic examples here, not when working with a list column. @@ -130,4 +130,4 @@ If this is an unexpected constraint violation please double check with the known ## Functions -See [Nested Functions]({% link docs/sql/functions/nested.md %}). +See [List Functions]({% link docs/sql/functions/list.md %}). diff --git a/docs/sql/data_types/map.md b/docs/sql/data_types/map.md index 672cb18d6f2..aec10ef103e 100644 --- a/docs/sql/data_types/map.md +++ b/docs/sql/data_types/map.md @@ -93,4 +93,4 @@ and a `NULL` nested value member will compare above a non-`NULL` nested value me ## Functions -See [Nested Functions]({% link docs/sql/functions/nested.md %}). +See [Map Functions]({% link docs/sql/functions/map.md %}). diff --git a/docs/sql/data_types/struct.md b/docs/sql/data_types/struct.md index 4996327d03d..d62dbecb406 100644 --- a/docs/sql/data_types/struct.md +++ b/docs/sql/data_types/struct.md @@ -7,7 +7,7 @@ Conceptually, a `STRUCT` column contains an ordered list of columns called “en `STRUCT`s are typically used to nest multiple columns into a single column, and the nested column can be of any type, including other `STRUCT`s and `LIST`s. -`STRUCT`s are similar to PostgreSQL's `ROW` type. The key difference is that DuckDB `STRUCT`s require the same keys in each row of a `STRUCT` column. This allows DuckDB to provide significantly improved performance by fully utilizing its vectorized execution engine, and also enforces type consistency for improved correctness. DuckDB includes a `row` function as a special way to produce a `STRUCT`, but does not have a `ROW` data type. See an example below and the [nested functions docs]({% link docs/sql/functions/nested.md %}#struct-functions) for details. +`STRUCT`s are similar to PostgreSQL's `ROW` type. The key difference is that DuckDB `STRUCT`s require the same keys in each row of a `STRUCT` column. This allows DuckDB to provide significantly improved performance by fully utilizing its vectorized execution engine, and also enforces type consistency for improved correctness. DuckDB includes a `row` function as a special way to produce a `STRUCT`, but does not have a `ROW` data type. See an example below and the [`STRUCT` functions documentation]({% link docs/sql/functions/struct.md %}) for details. `STRUCT`s have a fixed schema. It is not possible to change the schema of a `STRUCT` using `UPDATE` operations. @@ -15,7 +15,7 @@ See the [data types overview]({% link docs/sql/data_types/overview.md %}) for a ### Creating Structs -Structs can be created using the [`struct_pack(name := expr, ...)`]({% link docs/sql/functions/nested.md %}#struct-functions) function, the equivalent array notation `{'name': expr, ...}`, using a row variable, or using the `row` function. +Structs can be created using the [`struct_pack(name := expr, ...)`]({% link docs/sql/functions/struct.md %}) function, the equivalent array notation `{'name': expr, ...}`, using a row variable, or using the `row` function. Create a struct using the `struct_pack` function. Note the lack of single quotes around the keys and the use of the `:=` operator: @@ -73,7 +73,7 @@ SELECT struct_insert({'a': 1, 'b': 2, 'c': 3}, d := 4) AS s; ### Retrieving from Structs -Retrieving a value from a struct can be accomplished using dot notation, bracket notation, or through [struct functions]({% link docs/sql/functions/nested.md %}#struct-functions) like `struct_extract`. +Retrieving a value from a struct can be accomplished using dot notation, bracket notation, or through [struct functions]({% link docs/sql/functions/struct.md %}) like `struct_extract`. Use dot notation to retrieve the value at a key's location. In the following query, the subquery generates a struct column `a`, which we then query with `a.x`. @@ -290,4 +290,4 @@ and type STRUCT(k2 INTEGER, k1 INTEGER) - an explicit cast is required ## Functions -See [Nested Functions]({% link docs/sql/functions/nested.md %}). +See [Struct Functions]({% link docs/sql/functions/struct.md %}). diff --git a/docs/sql/data_types/union.md b/docs/sql/data_types/union.md index a49110385f0..d8a743fec82 100644 --- a/docs/sql/data_types/union.md +++ b/docs/sql/data_types/union.md @@ -9,7 +9,7 @@ A `UNION` *type* (not to be confused with the SQL [`UNION` operator]({% link doc Under the hood, `UNION` types are implemented on top of `STRUCT` types, and simply keep the “tag” as the first entry. -`UNION` values can be created with the [`union_value(tag := expr)`]({% link docs/sql/functions/nested.md %}#union-functions) function or by [casting from a member type](#casting-to-unions). +`UNION` values can be created with the [`union_value(tag := expr)`]({% link docs/sql/functions/union.md %}) function or by [casting from a member type](#casting-to-unions). ## Example @@ -111,4 +111,4 @@ Since `UNION` types are implemented on top of `STRUCT` types internally, they ca ## Functions -See [Nested Functions]({% link docs/sql/functions/nested.md %}#union-functions). +See [Union Functions]({% link docs/sql/functions/union.md %}). diff --git a/docs/sql/expressions/star.md b/docs/sql/expressions/star.md index 4dacfbfdc3e..4713cceb9a1 100644 --- a/docs/sql/expressions/star.md +++ b/docs/sql/expressions/star.md @@ -252,7 +252,7 @@ FROM (SELECT NULL a, 42 b, true c); The `*` expression can also be used to retrieve all keys from a struct as separate columns. This is particularly useful when a prior operation creates a struct of unknown shape, or if a query must handle any potential struct keys. -See the [`STRUCT` data type]({% link docs/sql/data_types/struct.md %}) and [nested functions]({% link docs/sql/functions/nested.md %}) pages for more details on working with structs. +See the [`STRUCT` data type]({% link docs/sql/data_types/struct.md %}) and [`STRUCT` functions]({% link docs/sql/functions/struct.md %}) pages for more details on working with structs. For example: diff --git a/docs/sql/functions/array.md b/docs/sql/functions/array.md index 01f61345796..2a7d3897b14 100644 --- a/docs/sql/functions/array.md +++ b/docs/sql/functions/array.md @@ -5,7 +5,7 @@ title: Array Functions -All [`LIST` functions]({% link docs/sql/functions/nested.md %}#list-functions) work with the [`ARRAY` data type]({% link docs/sql/data_types/array.md %}). Additionally, several `ARRAY`-native functions are also supported. +All [`LIST` functions]({% link docs/sql/functions/list.md %}) work with the [`ARRAY` data type]({% link docs/sql/data_types/array.md %}). Additionally, several `ARRAY`-native functions are also supported. ## Array-Native Functions diff --git a/docs/sql/query_syntax/unnest.md b/docs/sql/query_syntax/unnest.md index e7b6bc33f1a..41d58e827e1 100644 --- a/docs/sql/query_syntax/unnest.md +++ b/docs/sql/query_syntax/unnest.md @@ -151,7 +151,7 @@ SELECT unnest([[[1, 2], [3, 4]], [[5, 6], [7, 8, 9], []], [[10, 11]]], max_depth ### Keeping Track of List Entry Positions -To keep track of each entry's position within the original list, `unnest` may be combined with [`generate_subscripts`]({% link docs/sql/functions/nested.md %}#generate_subscripts): +To keep track of each entry's position within the original list, `unnest` may be combined with [`generate_subscripts`]({% link docs/sql/functions/list.md %}#generate_subscripts): ```sql SELECT unnest(l) as x, generate_subscripts(l, 1) AS index