SQL
Union Type
A `UNION` *type* (not to be confused with the SQL [`UNION` operator](#docs:sql:query_syntax:setops::union-all-by-name)) is a nested type capable of holding one of multiple “alternative” values, much like the `union` in C. The main difference being that these `UNION` types are *tagged unions* and thus always carry 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.  
`UNION` types must always 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 256 members.  
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)`](#docs:sql:functions:union) function or by [casting from a member type](#::casting-to-unions).