Results of 1 - 10 of about 62 for union (0.002 sec.)
- Union Type 13004
- A UNION type (not to be confused with the SQL UNION operator ) is a nested type capable of holding one of multiple “alternative” values, much like the union in C. The main difference is that these UNION types are tagged unions and thus alwa
...rry a discriminator “tag” which signals which alternative it is currently holding, even if the inner value itself is null. UNION types are thus more similar to C++17's std::variant , Rust's Enum or the “sum type” present in most functional languages....ways have at least one member, and while they can contain multiple members of the same type, the tag names must be unique. UNION types can have at most 255 members. Under the hood, UNION types are implemented on top of STRUCT types, and simply keep th...e “tag” as the first entry. UNION values can be created with the union_value(tag := expr) function or by casting from a member type . Example Create a table... - https://man.mtool.work/duckdb/2.0/sql/data_types/union.html
- Union Functions 12354
- Name Description union.tag Dot notation serves as an alias for union_extract . union_extract(union, 'tag') Extract the value with the named tags from the union. NULL if the tag is not currently selected. union_value(tag := any) Create a sin
...gle member UNION containing the argument value. The tag of the value will be the bound variable name. union_tag(union) Retrieve the current...ly selected tag of the union as an Enum . union.tag | Description | Dot notation serves as an alias for union_extract . | | Example | (union_value(k :=...'hello')).k | | Result | hello | union_extract(union, 'tag') | Description | Extract the value with the named tags from the union. NULL if the tag is not current... - https://man.mtool.work/duckdb/2.0/sql/functions/union.html
- WITH Clause 11039
- The WITH clause allows you to specify common table expressions (CTEs). Regular (non-recursive) common-table-expressions are essentially views that are limited in scope to a particular query. CTEs can reference each other and can be nested.
...onDepth, FibonacciNumber, NextNumber ) AS ( -- Base case SELECT 0 AS RecursionDepth, 0 AS FibonacciNumber, 1 AS NextNumber UNION ALL -- Recursive step SELECT fib.RecursionDepth + 1 AS RecursionDepth, fib.NextNumber AS FibonacciNumber, fib.FibonacciNum...t ). WITH RECURSIVE tag_hierarchy(id, source, path) AS ( SELECT id, name, [name] AS path FROM tag WHERE subclassof IS NULL UNION ALL SELECT tag.id, tag.name, list_prepend(tag.name, tag_hierarchy.path) FROM tag, tag_hierarchy WHERE tag.subclassof = tag...t edge of the traversal node1id AS startNode, node2id AS endNode, [node1id, node2id] AS path FROM edge WHERE startNode = 1 UNION ALL SELECT -- Concatenate new edge to the path paths.startNode AS startNode, node2id AS endNode, array_append(path, node2i... - https://man.mtool.work/duckdb/2.0/sql/query_syntax/with.html
- Set Operations 10822
- Set operations allow queries to be combined according to set operation semantics . Set operations refer to the UNION [ALL] , INTERSECT [ALL] and EXCEPT [ALL] clauses. The vanilla variants use set semantics, i.e., they eliminate duplicates,
...not of the same type, casts may be added. The result will use the column names from the first query. DuckDB also supports UNION [ALL] BY NAME , which joins columns by name instead of by position. UNION BY NAME does not require the inputs to have the...same number of columns. NULL values will be added in case of missing columns. UNION The UNION clause can be used to combine rows from multiple queries. The queries are required to return the same number of...one of the returned types is performed to combine columns of different types where necessary. If this is not possible, the UNION clause throws an error. Vanilla UNION (Set Semantics) The vanilla UNION clause follows set semantics, therefore it perform... - https://man.mtool.work/duckdb/2.0/sql/query_syntax/setops.html
- Data Types 9579
- General-Purpose Data Types The table below shows all the built-in general-purpose data types. The alternatives listed in the aliases column can be used to refer to these types as well, however, note that the aliases are not part of the SQL
...r details. Nested / Composite Types DuckDB supports the following nested data types: ARRAY , LIST , MAP , STRUCT , TUPLE , UNION and VARIANT . Each supports different use cases and has a different structure. Name Description Rules when used in a colum...pe for each position. Each row must have the same number of entries with the same types. (42, 'a') TUPLE(INTEGER, VARCHAR) UNION A union of multiple alternative data types, storing one of them in each value at a time. A union also contains a discrimin...ator “tag” value to inspect and access the currently set member type. Rows may be set to different member types of the union. union_value(num := 2) UNION(num INTEGER, text VARCHAR) VARIANT A semi-structured type where each value is self-contained... - https://man.mtool.work/duckdb/2.0/sql/data_types/overview.html
- Combining Schemas 9536
- Examples Read a set of CSV files combining columns by position: SELECT * FROM read_csv('flights*.csv'); Read a set of CSV files combining columns by name: SELECT * FROM read_csv('flights*.csv', union_by_name = true); Combining Schemas When
...s works correctly as long as all files have the same schema. If the schema of the files differs, you might want to use the union_by_name option to allow DuckDB to construct the schema by reading all of the names instead. Below is an example of how bot...h methods work. Union by Position By default, DuckDB uses the schema of the first file and reads the columns of the subsequent files into it. Fo...8-01-02 AA New York, NY Los Angeles, CA 1988-01-03 AA New York, NY Los Angeles, CA This is equivalent to the SQL construct UNION ALL . Union by Name If you are processing multiple files that have different schemas, perhaps because columns have been ad... - https://man.mtool.work/duckdb/2.0/data/multiple_files/combining_schemas.html
- Types 8973
- DuckDB is a strongly typed database system. As such, every column has a single type specified. This type is constant over the entire column. That is to say, a column that is labeled as an INTEGER column will only contain INTEGER values. Duc
..._TYPE_LIST = 24, DUCKDB_TYPE_STRUCT = 25, DUCKDB_TYPE_MAP = 26, DUCKDB_TYPE_ARRAY = 33, DUCKDB_TYPE_UUID = 27, DUCKDB_TYPE_UNION = 28, DUCKDB_TYPE_BIT = 29, DUCKDB_TYPE_TIME_TZ = 30, DUCKDB_TYPE_TIMESTAMP_TZ = 31, DUCKDB_TYPE_ANY = 34, DUCKDB_TYPE_BIG...uckdb_create_map_type ( duckdb_logical_type key_type , duckdb_logical_type value_type ); duckdb_logical_type duckdb_create_union_type ( duckdb_logical_type * member_types , const char ** member_names , idx_t member_count ); duckdb_logical_type duckdb_...idx_t index ); duckdb_logical_type duckdb_struct_type_child_type ( duckdb_logical_type type , idx_t index ); idx_t duckdb_union_type_member_count ( duckdb_logical_type type ); char * duckdb_union_type_member_name ( duckdb_logical_type type , idx_t in... - https://man.mtool.work/duckdb/2.0/clients/c/types.html
- Types API 8655
- The DuckDBPyType class, duckdb.sqltypes.DuckDBPyType , represents one of the data types . Use DuckDBPyType to describe SQL types when declaring function parameters, return types or casts. Python types such as int are accepted too: int descr
...of the dict. import duckdb.sqltypes print(duckdb.sqltypes.DuckDBPyType({'a': str, 'b': int})) STRUCT(a VARCHAR, b BIGINT) Union[type_1, ... type_n] typing.Union objects, and unions written as type_1 | type_2 , map to a UNION type of the provided type...s. import duckdb.sqltypes from typing import Union print(duckdb.sqltypes.DuckDBPyType(Union[int, str, bool, bytearray])) print(duckdb.sqltypes.DuckDBPyType(int | str)) UNION...(u1 BIGINT, u2 VARCHAR, u3 BOOLEAN, u4 BLOB) UNION(u1 BIGINT, u2 VARCHAR) Creation Functions For the built-in types, you can use the constants defined in duckdb.sqltypes : D... - https://man.mtool.work/duckdb/2.0/clients/python/types.html
- Avro Extension 8149
- The avro extension enables DuckDB to read Apache Avro files. The avro extension was released as a community extension in late 2024 and became a core extension in early 2025. The read_avro Function The extension adds a single DuckDB function
...ke other systems, Avro does not treat NULL as a possible value in a range of e.g. INTEGER but instead represents NULL as a union of the actual type with a special NULL type. This is different to DuckDB, where any value can be NULL . Of course DuckDB a...lso supports UNION types, but this would be quite cumbersome to work with. This extension simplifies the Avro schema where possible: An Avro...union of any type and the special null type is simplified to just the non-null type. For example, an Avro record of the union type ["int","null"] becomes a DuckDB INTEGER , which just happens to be NULL sometimes. Similarly, an Avro union that cont... - https://man.mtool.work/duckdb/2.0/core_extensions/avro.html
- Nested Functions 8048
- The following nested data types have dedicated function pages ( TUPLE values are handled by the STRUCT functions): Name Type page Functions page ARRAY ARRAY type ARRAY functions LIST LIST type LIST functions MAP MAP type MAP functions STRUC
...T STRUCT type STRUCT functions UNION UNION type UNION functions VARIANT VARIANT type VARIANT functions... - https://man.mtool.work/duckdb/2.0/sql/functions/nested.html
DuckDB 2.0 Documentation / man.mtool.work