Results of 1 - 10 of about 54 for cast (0.003 sec.)
- Typecasting 13899
- Typecasting is an operation that converts a value in one particular data type to the closest corresponding value in another data type. Like other SQL engines, DuckDB supports both implicit and explicit typecasting. Explicit Casting Explicit
...typecasting is performed by using a CAST expression. For example, CAST(col AS VARCHAR) or col::VARCHAR explicitly cast the column c...ol to VARCHAR . See the cast page for more information. Implicit Casting In many situations, the system will add casts by itself. This is called implic...it casting and happens, for example, when a function is called with an argument that does not match the type of the function but c... - https://man.mtool.work/duckdb/2.0/sql/data_types/typecasting.html
- Casting 13038
- Casting refers to the operation of converting a value in a particular data type to the corresponding value in another data type. Casting can occur either implicitly or explicitly. The syntax described here performs an explicit cast. More in
...formation on casting can be found on the typecasting page . Explicit Casting The standard SQL syntax for explicit casting is CAST(expr AS TY...e of DuckDB's data types . DuckDB also supports the shorthand expr::TYPENAME , which is also present in PostgreSQL. SELECT CAST(i AS VARCHAR) AS i FROM generate_series(1, 3) tbl(i); i 1 2 3 SELECT i::DOUBLE AS i FROM generate_series(1, 3) tbl(i); i 1....0 2.0 3.0 Casting Rules Not all casts are possible. For example, it is not possible to convert an INTEGER to a DATE . Casts may also thro... - https://man.mtool.work/duckdb/2.0/sql/expressions/cast.html
- Union Type 12000
- 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
...and simply keep the “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 with a UNION column: CREATE TABLE tbl1 (u UNION(num INTEGER, str VARCHAR));...INSERT INTO tbl1 VALUES (1), ('two'), (union_value(str := 'three')); Any type can be implicitly cast to a UNION containing the type. Any UNION can also be implicitly cast to another UNION if the source UNION members are a s...ubset of the target's (if the cast is unambiguous). UNION uses the member types' VARCHAR cast functions when casting to VARCHAR : SELECT u FROM tbl1; u 1 two... - https://man.mtool.work/duckdb/2.0/sql/data_types/union.html
- Excel Export 8959
- DuckDB supports exporting data to Excel .xlsx files via the excel extension. Please note that .xls files are not supported. To install and load the extension, run: INSTALL excel; LOAD excel; Exporting Excel Sheets To export a table to an Ex
...f VARCHAR and DOUBLE , the following type conversions are automatically applied when writing XLSX files: Numeric types are cast to DOUBLE . Temporal types ( TIMESTAMP , DATE , TIME , etc.) are converted to Excel "serial" numbers, that is the number o...hen styled with a "number format" so that they appear as dates or times when opened in Excel. TIMESTAMP_TZ and TIME_TZ are cast to UTC TIMESTAMP and TIME respectively, with the timezone information being lost. BOOLEAN s are converted to 1 and 0 , wit...h a "number format" applied to make them appear as TRUE and FALSE in Excel. All other types are cast to VARCHAR and then written as text cells. But you can of course also explicitly cast columns to a different type before e... - https://man.mtool.work/duckdb/2.0/guides/file_formats/excel_export.html
- Complete API 8722
- This page contains the reference for DuckDB's C API. The reference contains several deprecation notices. These concern methods whose long-term availability is not guaranteed as they may be removed in the future. That said, DuckDB's develope
...a_chunk duckdb_stream_fetch_chunk ( duckdb_result result ); duckdb_data_chunk duckdb_fetch_chunk ( duckdb_result result ); Cast Functions duckdb_cast_function duckdb_create_cast_function (); void duckdb_cast_function_set_source_type ( duckdb_cast_fun...ction cast_function , duckdb_logical_type source_type ); void duckdb_cast_function_set_target_type ( duckdb_cast_function cast_functi...on , duckdb_logical_type target_type ); void duckdb_cast_function_set_implicit_cast_cost ( duckdb_cast_function cast_function , int64_t cost ); void duckdb_cast_function_set_funct... - https://man.mtool.work/duckdb/2.0/clients/c/api.html
- Enum Data Type 8573
- Name Description ENUM Dictionary representing all possible string values of a column The enum type represents a dictionary data structure with all possible unique values of a column. For example, a column storing the days of the week can be
...EMA my_schema; CREATE TYPE my_schema.mood AS ENUM ('sad', 'ok', 'happy'); Anonymous enums can be created on the fly during casting : SELECT 'clubs'::ENUM ('spades', 'hearts', 'diamonds', 'clubs'); You can also create an enum using a SELECT statement...kity-quack value. INSERT INTO person VALUES ('Hannes', 'quackity-quack'); Enums vs. Strings DuckDB enums are automatically cast to VARCHAR types whenever necessary. This characteristic allows for comparisons between different enums, or an enum and a...erson; current_mood contains_a happy true NULL NULL sad true ok false When comparing two different enum types, DuckDB will cast both to strings and perform a string comparison: CREATE TYPE new_mood AS ENUM ('happy', 'anxious'); SELECT * FROM person W... - https://man.mtool.work/duckdb/2.0/sql/data_types/enum.html
- JSON Type 8529
- DuckDB supports json via the JSON logical type. For example: SELECT '[1, null, {"key": "value"}]'::JSON; [1, null, {"key": "value"}] Logically, the JSON type is similar to a VARCHAR , but with the restriction that it must be valid JSON. Phy
...plicate keys are allowed in JSON objects: SELECT '{"a":1,"a":2}'::JSON; {"a":1,"a":2} We allow any of DuckDB's types to be cast to JSON, and JSON to be cast back to any of DuckDB's types, for example, to cast JSON to DuckDB's STRUCT type, run: SELECT...e, but also for non-nested types: SELECT '2023-05-12'::DATE::JSON; "2023-05-12" The only exception to this behavior is the cast from VARCHAR to JSON , which does not alter the data, but instead parses and validates the contents of the VARCHAR as JSON... - https://man.mtool.work/duckdb/2.0/data/json/json_type.html
- Swift Client 8395
- DuckDB has a Swift client. See the announcement post for details. Instantiating DuckDB DuckDB supports both in-memory and persistent databases. To work with an in-memory database, run: let database = try Database(store: .inMemory) To work w
...B from within Swift via an async function. This means the callee won't be blocked while the query is executing. We'll then cast the result columns to Swift native types using DuckDB's ResultSet cast(to:) family of methods, before finally wrapping the...ection.query(""" SELECT disc_year, count(disc_year) AS Count FROM exoplanets GROUP BY disc_year ORDER BY disc_year """) // Cast our DuckDB columns to their native Swift // equivalent types let discoveryYearColumn = result[0].cast(to: Int.self) let co...untColumn = result[1].cast(to: Int.self) // Use our DuckDB columns to instantiate TabularData // columns and populate a TabularData DataFrame return... - https://man.mtool.work/duckdb/2.0/clients/tertiary_clients/swift.html
- ODBC Extension 7921
- Please note that DuckDB also offers an ODBC client , which allows you to connect to DuckDB via ODBC from other applications. The odbc_scanner extension allows connecting to other databases (using their ODBC drivers ) and run queries with th
...tvariable('conn'), 'SELECT SYSTIMESTAMP FROM DUAL'); -- query with parameters FROM odbc_query(getvariable('conn'), 'SELECT CAST(? AS NVARCHAR2(2)) || CAST(? AS VARCHAR2(5)) FROM DUAL', params = row('?', 'quack')); -- copy data into remote DB FROM odb...ignored, so the row() function can be used to create a STRUCT value inline: FROM odbc_query( getvariable('conn'), ' SELECT CAST(? AS VARCHAR2(3)) || CAST(? AS VARCHAR2(3)) FROM DUAL ', params = row(?, ?)) If we prepare this query with duckdb_prepare(...kdb_prepare()' is called, the inner query will be prepared in the remote DB FROM odbc_query( getvariable('conn'), ' SELECT CAST(? AS VARCHAR2(3)) || CAST(? AS VARCHAR2(3)) FROM DUAL ', params_handle = getvariable('params')); -- now we can repeatedly... - https://man.mtool.work/duckdb/2.0/core_extensions/odbc/overview.html
- Excel Extension 7624
- The excel extension provides functions to format numbers per Excel's formatting rules by wrapping the i18npool library and to read/write Excel ( .xlsx ) files. However, please note that .xls files are not supported. Installing and Loading T
...lls as containing VARCHAR s. ignore_errors BOOLEAN false Whether to ignore errors and silently replace cells that can't be cast to the corresponding inferred column type with NULL 's. range VARCHAR automatically inferred The range of cells to read, i...ing columns are determined by the types of the columns in the table being copied to. All cells will simply be converted by casting from DOUBLE or VARCHAR to the target column type. Writing XLSX Files Writing .xlsx files is supported using the COPY st...e equivalent of VARCHAR and DOUBLE , the following type conversions are applied when writing XLSX files. Numeric types are cast to DOUBLE when writing to an XLSX file. Temporal types ( TIMESTAMP , DATE , TIME , etc.) are converted to excel "serial" n... - https://man.mtool.work/duckdb/2.0/core_extensions/excel.html
DuckDB 2.0 Documentation / man.mtool.work