Package 'dd'

Title: Documentation for Functions Provided by DuckDB
Description: Lists DuckDB functions for integration in R's help system.
Authors: Kirill Müller [aut, cre] (ORCID: <https://orcid.org/0000-0002-1416-3412>), cynkra GmbH [fnd, cph] (ROR: <https://ror.org/0335t7e62>)
Maintainer: Kirill Müller <[email protected]>
License: MIT + file LICENSE
Version: 0.0.0.9000
Built: 2026-10-10 07:25:55 UTC
Source: https://github.com/cynkra/dd

Help Index


DuckDB function /

Description

DuckDB function ⁠/()⁠.

Usage

`/`(col0, col1)

Arguments

col0

FLOAT | DOUBLE | INTERVAL

col1

FLOAT | DOUBLE

Value

FLOAT | DOUBLE | INTERVAL


DuckDB function &

Description

Bitwise AND.

Usage

`&`(left, right)

Arguments

left, right

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

91 & 15

DuckDB function <<

Description

Bitwise shift left.

Usage

`<<`(input, col1)

Arguments

input

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

1 << 4

DuckDB function <<=

Description

DuckDB function ⁠<<=()⁠.

Usage

`<<=`(col0, col1)

Arguments

col0, col1

INET

Value

BOOLEAN

Provided by

The inet extension (LOAD inet;).


DuckDB function >>

Description

Bitwise shift right.

Usage

`>>`(input, col1)

Arguments

input

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

8 >> 2

DuckDB function >>=

Description

DuckDB function ⁠>>=()⁠.

Usage

`>>=`(col0, col1)

Arguments

col0, col1

INET

Value

BOOLEAN

Provided by

The inet extension (LOAD inet;).


DuckDB function ~

Description

Bitwise NOT.

Usage

`~`(input)

Arguments

input

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

~15

DuckDB function ~~

Description

DuckDB function ⁠~~()⁠.

Usage

`~~`(col0, col1)

Arguments

col0, col1

VARCHAR

Value

BOOLEAN


DuckDB function ~~*

Description

DuckDB function ⁠~~*()⁠.

Usage

`~~*`(col0, col1)

Arguments

col0, col1

VARCHAR

Value

BOOLEAN


DuckDB function ~~~

Description

DuckDB function ⁠~~~()⁠.

Usage

`~~~`(col0, col1)

Arguments

col0, col1

VARCHAR

Value

BOOLEAN


DuckDB function abs

Description

Absolute value.

Usage

abs(x)

Arguments

x

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

SQL examples

abs(-17.4)

DuckDB function acos

Description

Computes the arccosine of x.

Usage

acos(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

acos(0.5)

DuckDB function acosh

Description

Computes the inverse hyperbolic cos of x.

Usage

acosh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

acosh(2.3)

DuckDB function add

Description

DuckDB function add().

Usage

add(col0, col1)

Arguments

col0, col1

⁠TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | BIGNUM⁠

Value

⁠TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | DATE | INTERVAL | TIMESTAMP | TIME | TIME WITH TIME ZONE | TIMESTAMP WITH TIME ZONE | ANY[] | BIGNUM⁠

Overloads

  • add(col0 = TINYINT)

  • add(col0 = TINYINT, col1 = TINYINT)

  • add(col0 = SMALLINT)

  • add(col0 = SMALLINT, col1 = SMALLINT)

  • add(col0 = INTEGER)

  • add(col0 = INTEGER, col1 = INTEGER)

  • add(col0 = BIGINT)

  • add(col0 = BIGINT, col1 = BIGINT)

  • add(col0 = HUGEINT)

  • add(col0 = HUGEINT, col1 = HUGEINT)

  • add(col0 = FLOAT)

  • add(col0 = FLOAT, col1 = FLOAT)

  • add(col0 = DOUBLE)

  • add(col0 = DOUBLE, col1 = DOUBLE)

  • add(col0 = DECIMAL)

  • add(col0 = DECIMAL, col1 = DECIMAL)

  • add(col0 = UTINYINT)

  • add(col0 = UTINYINT, col1 = UTINYINT)

  • add(col0 = USMALLINT)

  • add(col0 = USMALLINT, col1 = USMALLINT)

  • add(col0 = UINTEGER)

  • add(col0 = UINTEGER, col1 = UINTEGER)

  • add(col0 = UBIGINT)

  • add(col0 = UBIGINT, col1 = UBIGINT)

  • add(col0 = UHUGEINT)

  • add(col0 = UHUGEINT, col1 = UHUGEINT)

  • add(col0 = DATE, col1 = INTEGER)

  • add(col0 = INTEGER, col1 = DATE)

  • add(col0 = INTERVAL, col1 = INTERVAL)

  • add(col0 = DATE, col1 = INTERVAL)

  • add(col0 = INTERVAL, col1 = DATE)

  • add(col0 = TIME, col1 = INTERVAL)

  • add(col0 = INTERVAL, col1 = TIME)

  • add(col0 = TIMESTAMP, col1 = INTERVAL)

  • add(col0 = INTERVAL, col1 = TIMESTAMP)

  • add(col0 = `TIME WITH TIME ZONE`, col1 = INTERVAL)

  • add(col0 = INTERVAL, col1 = `TIME WITH TIME ZONE`)

  • add(col0 = TIME, col1 = DATE)

  • add(col0 = DATE, col1 = TIME)

  • add(col0 = `TIME WITH TIME ZONE`, col1 = DATE)

  • add(col0 = DATE, col1 = `TIME WITH TIME ZONE`)

  • add()

  • add(col0 = BIGNUM, col1 = BIGNUM)


DuckDB function add_parquet_key

Description

DuckDB function add_parquet_key().

Usage

add_parquet_key(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.


DuckDB function age

Description

Subtract arguments, resulting in the time difference between the two timestamps.

Usage

age(timestamp, timestamp.1)

Arguments

timestamp, timestamp.1

⁠TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

INTERVAL

Overloads

  • age(timestamp = TIMESTAMP)

  • age(timestamp = TIMESTAMP, timestamp.1 = TIMESTAMP)

  • age(timestamp = `TIMESTAMP WITH TIME ZONE`)

  • age(timestamp = `TIMESTAMP WITH TIME ZONE`, timestamp.1 = `TIMESTAMP WITH TIME ZONE`)

SQL examples

age(TIMESTAMP '2001-04-10', TIMESTAMP '1992-09-20')

DuckDB function ago

Description

DuckDB macro ago().

Usage

ago(i)

Arguments

i

Unspecified.

Value

Unspecified.


DuckDB function alias

Description

Returns the name of a given expression.

Usage

alias(expr)

Arguments

expr

ANY

Value

VARCHAR

SQL examples

alias(42 + 1)

DuckDB function all_profiling_output

Description

DuckDB function all_profiling_output().

Usage

all_profiling_output()

Value

Unspecified.


DuckDB function any_value

Description

Returns the first non-NULL value from arg. This function is affected by ordering.

Usage

any_value(arg)

Arguments

arg

DECIMAL | ANY

Value

DECIMAL | ANY


DuckDB function approx_count_distinct

Description

Computes the approximate count of distinct elements using HyperLogLog.

Usage

approx_count_distinct(any)

Arguments

any

ANY

Value

BIGINT

SQL examples

approx_count_distinct(A)

DuckDB function approx_quantile

Description

Computes the approximate quantile using T-Digest.

Usage

approx_quantile(x, pos)

Arguments

x

⁠DECIMAL | SMALLINT | INTEGER | BIGINT | HUGEINT | DOUBLE | DATE | TIME | TIME WITH TIME ZONE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TINYINT | FLOAT⁠

pos

FLOAT | FLOAT[]

Value

⁠DECIMAL | SMALLINT | INTEGER | BIGINT | HUGEINT | DOUBLE | DATE | TIME | TIME WITH TIME ZONE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | DECIMAL[] | TINYINT[] | SMALLINT[] | INTEGER[] | BIGINT[] | HUGEINT[] | FLOAT[] | DOUBLE[] | DATE[] | TIME[] | TIME WITH TIME ZONE[] | TIMESTAMP[] | TIMESTAMP WITH TIME ZONE[]⁠

SQL examples

approx_quantile(x, 0.5)

DuckDB function approx_top_k

Description

Finds the k approximately most occurring values in the data set.

Usage

approx_top_k(val, k)

Arguments

val

ANY

k

BIGINT

Value

ANY[]

SQL examples

approx_top_k(x, 5)

DuckDB function arg_max

Description

Finds the row with the maximum val. Calculates the non-NULL arg expression at that row.

Usage

arg_max(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY | ANY[]⁠

Overloads

  • arg_max(arg = INTEGER, val = INTEGER)

  • arg_max(arg = INTEGER, val = BIGINT)

  • arg_max(arg = INTEGER, val = HUGEINT)

  • arg_max(arg = INTEGER, val = DOUBLE)

  • arg_max(arg = INTEGER, val = VARCHAR)

  • arg_max(arg = INTEGER, val = DATE)

  • arg_max(arg = INTEGER, val = TIMESTAMP)

  • arg_max(arg = INTEGER, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = INTEGER, val = BLOB)

  • arg_max(arg = BIGINT, val = INTEGER)

  • arg_max(arg = BIGINT, val = BIGINT)

  • arg_max(arg = BIGINT, val = HUGEINT)

  • arg_max(arg = BIGINT, val = DOUBLE)

  • arg_max(arg = BIGINT, val = VARCHAR)

  • arg_max(arg = BIGINT, val = DATE)

  • arg_max(arg = BIGINT, val = TIMESTAMP)

  • arg_max(arg = BIGINT, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = BIGINT, val = BLOB)

  • arg_max(arg = DOUBLE, val = INTEGER)

  • arg_max(arg = DOUBLE, val = BIGINT)

  • arg_max(arg = DOUBLE, val = HUGEINT)

  • arg_max(arg = DOUBLE, val = DOUBLE)

  • arg_max(arg = DOUBLE, val = VARCHAR)

  • arg_max(arg = DOUBLE, val = DATE)

  • arg_max(arg = DOUBLE, val = TIMESTAMP)

  • arg_max(arg = DOUBLE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = DOUBLE, val = BLOB)

  • arg_max(arg = VARCHAR, val = INTEGER)

  • arg_max(arg = VARCHAR, val = BIGINT)

  • arg_max(arg = VARCHAR, val = HUGEINT)

  • arg_max(arg = VARCHAR, val = DOUBLE)

  • arg_max(arg = VARCHAR, val = VARCHAR)

  • arg_max(arg = VARCHAR, val = DATE)

  • arg_max(arg = VARCHAR, val = TIMESTAMP)

  • arg_max(arg = VARCHAR, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = VARCHAR, val = BLOB)

  • arg_max(arg = DATE, val = INTEGER)

  • arg_max(arg = DATE, val = BIGINT)

  • arg_max(arg = DATE, val = HUGEINT)

  • arg_max(arg = DATE, val = DOUBLE)

  • arg_max(arg = DATE, val = VARCHAR)

  • arg_max(arg = DATE, val = DATE)

  • arg_max(arg = DATE, val = TIMESTAMP)

  • arg_max(arg = DATE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = DATE, val = BLOB)

  • arg_max(arg = TIMESTAMP, val = INTEGER)

  • arg_max(arg = TIMESTAMP, val = BIGINT)

  • arg_max(arg = TIMESTAMP, val = HUGEINT)

  • arg_max(arg = TIMESTAMP, val = DOUBLE)

  • arg_max(arg = TIMESTAMP, val = VARCHAR)

  • arg_max(arg = TIMESTAMP, val = DATE)

  • arg_max(arg = TIMESTAMP, val = TIMESTAMP)

  • arg_max(arg = TIMESTAMP, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = TIMESTAMP, val = BLOB)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = INTEGER)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = BIGINT)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = HUGEINT)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = DOUBLE)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = VARCHAR)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = DATE)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = TIMESTAMP)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = `TIMESTAMP WITH TIME ZONE`, val = BLOB)

  • arg_max(arg = BLOB, val = INTEGER)

  • arg_max(arg = BLOB, val = BIGINT)

  • arg_max(arg = BLOB, val = HUGEINT)

  • arg_max(arg = BLOB, val = DOUBLE)

  • arg_max(arg = BLOB, val = VARCHAR)

  • arg_max(arg = BLOB, val = DATE)

  • arg_max(arg = BLOB, val = TIMESTAMP)

  • arg_max(arg = BLOB, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = BLOB, val = BLOB)

  • arg_max(arg = DECIMAL, val = INTEGER)

  • arg_max(arg = DECIMAL, val = BIGINT)

  • arg_max(arg = DECIMAL, val = HUGEINT)

  • arg_max(arg = DECIMAL, val = DOUBLE)

  • arg_max(arg = DECIMAL, val = VARCHAR)

  • arg_max(arg = DECIMAL, val = DATE)

  • arg_max(arg = DECIMAL, val = TIMESTAMP)

  • arg_max(arg = DECIMAL, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = DECIMAL, val = BLOB)

  • arg_max(arg = ANY, val = INTEGER)

  • arg_max(arg = ANY, val = BIGINT)

  • arg_max(arg = ANY, val = HUGEINT)

  • arg_max(arg = ANY, val = DOUBLE)

  • arg_max(arg = ANY, val = VARCHAR)

  • arg_max(arg = ANY, val = DATE)

  • arg_max(arg = ANY, val = TIMESTAMP)

  • arg_max(arg = ANY, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max(arg = ANY, val = BLOB)

  • arg_max(arg = ANY, val = ANY)

  • arg_max(arg = ANY, val = ANY, col2 = BIGINT)

SQL examples

arg_max(A, B)

DuckDB function arg_max_null

Description

Finds the row with the maximum val. Calculates the arg expression at that row.

Usage

arg_max_null(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

SQL examples

arg_max_null(A, B)

DuckDB function arg_max_nulls_last

Description

Finds the rows with N maximum vals, including nulls. Calculates the arg expression at that row.

Usage

arg_max_nulls_last(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY | ANY[]⁠

Overloads

  • arg_max_nulls_last(arg = INTEGER, val = INTEGER)

  • arg_max_nulls_last(arg = INTEGER, val = BIGINT)

  • arg_max_nulls_last(arg = INTEGER, val = HUGEINT)

  • arg_max_nulls_last(arg = INTEGER, val = DOUBLE)

  • arg_max_nulls_last(arg = INTEGER, val = VARCHAR)

  • arg_max_nulls_last(arg = INTEGER, val = DATE)

  • arg_max_nulls_last(arg = INTEGER, val = TIMESTAMP)

  • arg_max_nulls_last(arg = INTEGER, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = INTEGER, val = BLOB)

  • arg_max_nulls_last(arg = BIGINT, val = INTEGER)

  • arg_max_nulls_last(arg = BIGINT, val = BIGINT)

  • arg_max_nulls_last(arg = BIGINT, val = HUGEINT)

  • arg_max_nulls_last(arg = BIGINT, val = DOUBLE)

  • arg_max_nulls_last(arg = BIGINT, val = VARCHAR)

  • arg_max_nulls_last(arg = BIGINT, val = DATE)

  • arg_max_nulls_last(arg = BIGINT, val = TIMESTAMP)

  • arg_max_nulls_last(arg = BIGINT, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = BIGINT, val = BLOB)

  • arg_max_nulls_last(arg = DOUBLE, val = INTEGER)

  • arg_max_nulls_last(arg = DOUBLE, val = BIGINT)

  • arg_max_nulls_last(arg = DOUBLE, val = HUGEINT)

  • arg_max_nulls_last(arg = DOUBLE, val = DOUBLE)

  • arg_max_nulls_last(arg = DOUBLE, val = VARCHAR)

  • arg_max_nulls_last(arg = DOUBLE, val = DATE)

  • arg_max_nulls_last(arg = DOUBLE, val = TIMESTAMP)

  • arg_max_nulls_last(arg = DOUBLE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = DOUBLE, val = BLOB)

  • arg_max_nulls_last(arg = VARCHAR, val = INTEGER)

  • arg_max_nulls_last(arg = VARCHAR, val = BIGINT)

  • arg_max_nulls_last(arg = VARCHAR, val = HUGEINT)

  • arg_max_nulls_last(arg = VARCHAR, val = DOUBLE)

  • arg_max_nulls_last(arg = VARCHAR, val = VARCHAR)

  • arg_max_nulls_last(arg = VARCHAR, val = DATE)

  • arg_max_nulls_last(arg = VARCHAR, val = TIMESTAMP)

  • arg_max_nulls_last(arg = VARCHAR, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = VARCHAR, val = BLOB)

  • arg_max_nulls_last(arg = DATE, val = INTEGER)

  • arg_max_nulls_last(arg = DATE, val = BIGINT)

  • arg_max_nulls_last(arg = DATE, val = HUGEINT)

  • arg_max_nulls_last(arg = DATE, val = DOUBLE)

  • arg_max_nulls_last(arg = DATE, val = VARCHAR)

  • arg_max_nulls_last(arg = DATE, val = DATE)

  • arg_max_nulls_last(arg = DATE, val = TIMESTAMP)

  • arg_max_nulls_last(arg = DATE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = DATE, val = BLOB)

  • arg_max_nulls_last(arg = TIMESTAMP, val = INTEGER)

  • arg_max_nulls_last(arg = TIMESTAMP, val = BIGINT)

  • arg_max_nulls_last(arg = TIMESTAMP, val = HUGEINT)

  • arg_max_nulls_last(arg = TIMESTAMP, val = DOUBLE)

  • arg_max_nulls_last(arg = TIMESTAMP, val = VARCHAR)

  • arg_max_nulls_last(arg = TIMESTAMP, val = DATE)

  • arg_max_nulls_last(arg = TIMESTAMP, val = TIMESTAMP)

  • arg_max_nulls_last(arg = TIMESTAMP, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = TIMESTAMP, val = BLOB)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = INTEGER)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = BIGINT)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = HUGEINT)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = DOUBLE)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = VARCHAR)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = DATE)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = TIMESTAMP)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = BLOB)

  • arg_max_nulls_last(arg = BLOB, val = INTEGER)

  • arg_max_nulls_last(arg = BLOB, val = BIGINT)

  • arg_max_nulls_last(arg = BLOB, val = HUGEINT)

  • arg_max_nulls_last(arg = BLOB, val = DOUBLE)

  • arg_max_nulls_last(arg = BLOB, val = VARCHAR)

  • arg_max_nulls_last(arg = BLOB, val = DATE)

  • arg_max_nulls_last(arg = BLOB, val = TIMESTAMP)

  • arg_max_nulls_last(arg = BLOB, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = BLOB, val = BLOB)

  • arg_max_nulls_last(arg = DECIMAL, val = INTEGER)

  • arg_max_nulls_last(arg = DECIMAL, val = BIGINT)

  • arg_max_nulls_last(arg = DECIMAL, val = HUGEINT)

  • arg_max_nulls_last(arg = DECIMAL, val = DOUBLE)

  • arg_max_nulls_last(arg = DECIMAL, val = VARCHAR)

  • arg_max_nulls_last(arg = DECIMAL, val = DATE)

  • arg_max_nulls_last(arg = DECIMAL, val = TIMESTAMP)

  • arg_max_nulls_last(arg = DECIMAL, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = DECIMAL, val = BLOB)

  • arg_max_nulls_last(arg = ANY, val = INTEGER)

  • arg_max_nulls_last(arg = ANY, val = BIGINT)

  • arg_max_nulls_last(arg = ANY, val = HUGEINT)

  • arg_max_nulls_last(arg = ANY, val = DOUBLE)

  • arg_max_nulls_last(arg = ANY, val = VARCHAR)

  • arg_max_nulls_last(arg = ANY, val = DATE)

  • arg_max_nulls_last(arg = ANY, val = TIMESTAMP)

  • arg_max_nulls_last(arg = ANY, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_max_nulls_last(arg = ANY, val = BLOB)

  • arg_max_nulls_last(arg = ANY, val = ANY)

  • arg_max_nulls_last(arg = ANY, val = ANY, N = BIGINT)

SQL examples

arg_min_null_val(A, B, N)

DuckDB function arg_min

Description

Finds the row with the minimum val. Calculates the non-NULL arg expression at that row.

Usage

arg_min(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY | ANY[]⁠

Overloads

  • arg_min(arg = INTEGER, val = INTEGER)

  • arg_min(arg = INTEGER, val = BIGINT)

  • arg_min(arg = INTEGER, val = HUGEINT)

  • arg_min(arg = INTEGER, val = DOUBLE)

  • arg_min(arg = INTEGER, val = VARCHAR)

  • arg_min(arg = INTEGER, val = DATE)

  • arg_min(arg = INTEGER, val = TIMESTAMP)

  • arg_min(arg = INTEGER, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = INTEGER, val = BLOB)

  • arg_min(arg = BIGINT, val = INTEGER)

  • arg_min(arg = BIGINT, val = BIGINT)

  • arg_min(arg = BIGINT, val = HUGEINT)

  • arg_min(arg = BIGINT, val = DOUBLE)

  • arg_min(arg = BIGINT, val = VARCHAR)

  • arg_min(arg = BIGINT, val = DATE)

  • arg_min(arg = BIGINT, val = TIMESTAMP)

  • arg_min(arg = BIGINT, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = BIGINT, val = BLOB)

  • arg_min(arg = DOUBLE, val = INTEGER)

  • arg_min(arg = DOUBLE, val = BIGINT)

  • arg_min(arg = DOUBLE, val = HUGEINT)

  • arg_min(arg = DOUBLE, val = DOUBLE)

  • arg_min(arg = DOUBLE, val = VARCHAR)

  • arg_min(arg = DOUBLE, val = DATE)

  • arg_min(arg = DOUBLE, val = TIMESTAMP)

  • arg_min(arg = DOUBLE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = DOUBLE, val = BLOB)

  • arg_min(arg = VARCHAR, val = INTEGER)

  • arg_min(arg = VARCHAR, val = BIGINT)

  • arg_min(arg = VARCHAR, val = HUGEINT)

  • arg_min(arg = VARCHAR, val = DOUBLE)

  • arg_min(arg = VARCHAR, val = VARCHAR)

  • arg_min(arg = VARCHAR, val = DATE)

  • arg_min(arg = VARCHAR, val = TIMESTAMP)

  • arg_min(arg = VARCHAR, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = VARCHAR, val = BLOB)

  • arg_min(arg = DATE, val = INTEGER)

  • arg_min(arg = DATE, val = BIGINT)

  • arg_min(arg = DATE, val = HUGEINT)

  • arg_min(arg = DATE, val = DOUBLE)

  • arg_min(arg = DATE, val = VARCHAR)

  • arg_min(arg = DATE, val = DATE)

  • arg_min(arg = DATE, val = TIMESTAMP)

  • arg_min(arg = DATE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = DATE, val = BLOB)

  • arg_min(arg = TIMESTAMP, val = INTEGER)

  • arg_min(arg = TIMESTAMP, val = BIGINT)

  • arg_min(arg = TIMESTAMP, val = HUGEINT)

  • arg_min(arg = TIMESTAMP, val = DOUBLE)

  • arg_min(arg = TIMESTAMP, val = VARCHAR)

  • arg_min(arg = TIMESTAMP, val = DATE)

  • arg_min(arg = TIMESTAMP, val = TIMESTAMP)

  • arg_min(arg = TIMESTAMP, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = TIMESTAMP, val = BLOB)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = INTEGER)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = BIGINT)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = HUGEINT)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = DOUBLE)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = VARCHAR)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = DATE)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = TIMESTAMP)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = `TIMESTAMP WITH TIME ZONE`, val = BLOB)

  • arg_min(arg = BLOB, val = INTEGER)

  • arg_min(arg = BLOB, val = BIGINT)

  • arg_min(arg = BLOB, val = HUGEINT)

  • arg_min(arg = BLOB, val = DOUBLE)

  • arg_min(arg = BLOB, val = VARCHAR)

  • arg_min(arg = BLOB, val = DATE)

  • arg_min(arg = BLOB, val = TIMESTAMP)

  • arg_min(arg = BLOB, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = BLOB, val = BLOB)

  • arg_min(arg = DECIMAL, val = INTEGER)

  • arg_min(arg = DECIMAL, val = BIGINT)

  • arg_min(arg = DECIMAL, val = HUGEINT)

  • arg_min(arg = DECIMAL, val = DOUBLE)

  • arg_min(arg = DECIMAL, val = VARCHAR)

  • arg_min(arg = DECIMAL, val = DATE)

  • arg_min(arg = DECIMAL, val = TIMESTAMP)

  • arg_min(arg = DECIMAL, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = DECIMAL, val = BLOB)

  • arg_min(arg = ANY, val = INTEGER)

  • arg_min(arg = ANY, val = BIGINT)

  • arg_min(arg = ANY, val = HUGEINT)

  • arg_min(arg = ANY, val = DOUBLE)

  • arg_min(arg = ANY, val = VARCHAR)

  • arg_min(arg = ANY, val = DATE)

  • arg_min(arg = ANY, val = TIMESTAMP)

  • arg_min(arg = ANY, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min(arg = ANY, val = BLOB)

  • arg_min(arg = ANY, val = ANY)

  • arg_min(arg = ANY, val = ANY, col2 = BIGINT)

SQL examples

arg_min(A, B)

DuckDB function arg_min_null

Description

Finds the row with the minimum val. Calculates the arg expression at that row.

Usage

arg_min_null(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

SQL examples

arg_min_null(A, B)

DuckDB function arg_min_nulls_last

Description

Finds the rows with N minimum vals, including nulls. Calculates the arg expression at that row.

Usage

arg_min_nulls_last(arg, val)

Arguments

arg

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY⁠

val

⁠INTEGER | BIGINT | HUGEINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | ANY⁠

Value

⁠INTEGER | BIGINT | DOUBLE | VARCHAR | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | BLOB | DECIMAL | ANY | ANY[]⁠

Overloads

  • arg_min_nulls_last(arg = INTEGER, val = INTEGER)

  • arg_min_nulls_last(arg = INTEGER, val = BIGINT)

  • arg_min_nulls_last(arg = INTEGER, val = HUGEINT)

  • arg_min_nulls_last(arg = INTEGER, val = DOUBLE)

  • arg_min_nulls_last(arg = INTEGER, val = VARCHAR)

  • arg_min_nulls_last(arg = INTEGER, val = DATE)

  • arg_min_nulls_last(arg = INTEGER, val = TIMESTAMP)

  • arg_min_nulls_last(arg = INTEGER, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = INTEGER, val = BLOB)

  • arg_min_nulls_last(arg = BIGINT, val = INTEGER)

  • arg_min_nulls_last(arg = BIGINT, val = BIGINT)

  • arg_min_nulls_last(arg = BIGINT, val = HUGEINT)

  • arg_min_nulls_last(arg = BIGINT, val = DOUBLE)

  • arg_min_nulls_last(arg = BIGINT, val = VARCHAR)

  • arg_min_nulls_last(arg = BIGINT, val = DATE)

  • arg_min_nulls_last(arg = BIGINT, val = TIMESTAMP)

  • arg_min_nulls_last(arg = BIGINT, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = BIGINT, val = BLOB)

  • arg_min_nulls_last(arg = DOUBLE, val = INTEGER)

  • arg_min_nulls_last(arg = DOUBLE, val = BIGINT)

  • arg_min_nulls_last(arg = DOUBLE, val = HUGEINT)

  • arg_min_nulls_last(arg = DOUBLE, val = DOUBLE)

  • arg_min_nulls_last(arg = DOUBLE, val = VARCHAR)

  • arg_min_nulls_last(arg = DOUBLE, val = DATE)

  • arg_min_nulls_last(arg = DOUBLE, val = TIMESTAMP)

  • arg_min_nulls_last(arg = DOUBLE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = DOUBLE, val = BLOB)

  • arg_min_nulls_last(arg = VARCHAR, val = INTEGER)

  • arg_min_nulls_last(arg = VARCHAR, val = BIGINT)

  • arg_min_nulls_last(arg = VARCHAR, val = HUGEINT)

  • arg_min_nulls_last(arg = VARCHAR, val = DOUBLE)

  • arg_min_nulls_last(arg = VARCHAR, val = VARCHAR)

  • arg_min_nulls_last(arg = VARCHAR, val = DATE)

  • arg_min_nulls_last(arg = VARCHAR, val = TIMESTAMP)

  • arg_min_nulls_last(arg = VARCHAR, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = VARCHAR, val = BLOB)

  • arg_min_nulls_last(arg = DATE, val = INTEGER)

  • arg_min_nulls_last(arg = DATE, val = BIGINT)

  • arg_min_nulls_last(arg = DATE, val = HUGEINT)

  • arg_min_nulls_last(arg = DATE, val = DOUBLE)

  • arg_min_nulls_last(arg = DATE, val = VARCHAR)

  • arg_min_nulls_last(arg = DATE, val = DATE)

  • arg_min_nulls_last(arg = DATE, val = TIMESTAMP)

  • arg_min_nulls_last(arg = DATE, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = DATE, val = BLOB)

  • arg_min_nulls_last(arg = TIMESTAMP, val = INTEGER)

  • arg_min_nulls_last(arg = TIMESTAMP, val = BIGINT)

  • arg_min_nulls_last(arg = TIMESTAMP, val = HUGEINT)

  • arg_min_nulls_last(arg = TIMESTAMP, val = DOUBLE)

  • arg_min_nulls_last(arg = TIMESTAMP, val = VARCHAR)

  • arg_min_nulls_last(arg = TIMESTAMP, val = DATE)

  • arg_min_nulls_last(arg = TIMESTAMP, val = TIMESTAMP)

  • arg_min_nulls_last(arg = TIMESTAMP, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = TIMESTAMP, val = BLOB)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = INTEGER)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = BIGINT)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = HUGEINT)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = DOUBLE)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = VARCHAR)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = DATE)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = TIMESTAMP)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = `TIMESTAMP WITH TIME ZONE`, val = BLOB)

  • arg_min_nulls_last(arg = BLOB, val = INTEGER)

  • arg_min_nulls_last(arg = BLOB, val = BIGINT)

  • arg_min_nulls_last(arg = BLOB, val = HUGEINT)

  • arg_min_nulls_last(arg = BLOB, val = DOUBLE)

  • arg_min_nulls_last(arg = BLOB, val = VARCHAR)

  • arg_min_nulls_last(arg = BLOB, val = DATE)

  • arg_min_nulls_last(arg = BLOB, val = TIMESTAMP)

  • arg_min_nulls_last(arg = BLOB, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = BLOB, val = BLOB)

  • arg_min_nulls_last(arg = DECIMAL, val = INTEGER)

  • arg_min_nulls_last(arg = DECIMAL, val = BIGINT)

  • arg_min_nulls_last(arg = DECIMAL, val = HUGEINT)

  • arg_min_nulls_last(arg = DECIMAL, val = DOUBLE)

  • arg_min_nulls_last(arg = DECIMAL, val = VARCHAR)

  • arg_min_nulls_last(arg = DECIMAL, val = DATE)

  • arg_min_nulls_last(arg = DECIMAL, val = TIMESTAMP)

  • arg_min_nulls_last(arg = DECIMAL, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = DECIMAL, val = BLOB)

  • arg_min_nulls_last(arg = ANY, val = INTEGER)

  • arg_min_nulls_last(arg = ANY, val = BIGINT)

  • arg_min_nulls_last(arg = ANY, val = HUGEINT)

  • arg_min_nulls_last(arg = ANY, val = DOUBLE)

  • arg_min_nulls_last(arg = ANY, val = VARCHAR)

  • arg_min_nulls_last(arg = ANY, val = DATE)

  • arg_min_nulls_last(arg = ANY, val = TIMESTAMP)

  • arg_min_nulls_last(arg = ANY, val = `TIMESTAMP WITH TIME ZONE`)

  • arg_min_nulls_last(arg = ANY, val = BLOB)

  • arg_min_nulls_last(arg = ANY, val = ANY)

  • arg_min_nulls_last(arg = ANY, val = ANY, N = BIGINT)

SQL examples

arg_min_null_val(A, B, N)

DuckDB function array_agg

Description

Returns a LIST containing all the values of a column.

Usage

array_agg(arg)

Arguments

arg

T

Value

T[]

SQL examples

array_agg(A)
list(A)

DuckDB function array_append

Description

DuckDB macro array_append().

Usage

array_append(arr, el)

Arguments

arr, el

Unspecified.

Value

Unspecified.


DuckDB function array_cosine_distance

Description

Computes the cosine distance between two arrays of the same size. The array elements can not be NULL. The arrays can have any size as long as the size is the same for both arguments.

Usage

array_cosine_distance(array1, array2)

Arguments

array1, array2

FLOAT[ANY] | DOUBLE[ANY]

Value

FLOAT | DOUBLE

SQL examples

array_cosine_distance(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_similarity(), array_cross_product(), array_distance(), array_inner_product(), array_negative_inner_product(), array_value()


DuckDB function array_cosine_similarity

Description

Computes the cosine similarity between two arrays of the same size. The array elements can not be NULL. The arrays can have any size as long as the size is the same for both arguments.

Usage

array_cosine_similarity(array1, array2)

Arguments

array1, array2

FLOAT[ANY] | DOUBLE[ANY]

Value

FLOAT | DOUBLE

SQL examples

array_cosine_similarity(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_distance(), array_cross_product(), array_distance(), array_inner_product(), array_negative_inner_product(), array_value()


DuckDB function array_cross_product

Description

Computes the cross product of two arrays of size 3. The array elements can not be NULL.

Usage

array_cross_product(array, array.1)

Arguments

array, array.1

FLOAT[3] | DOUBLE[3]

Value

FLOAT[3] | DOUBLE[3]

SQL examples

array_cross_product(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_distance(), array_cosine_similarity(), array_distance(), array_inner_product(), array_negative_inner_product(), array_value()


DuckDB function array_distance

Description

Computes the distance between two arrays of the same size. The array elements can not be NULL. The arrays can have any size as long as the size is the same for both arguments.

Usage

array_distance(array1, array2)

Arguments

array1, array2

FLOAT[ANY] | DOUBLE[ANY]

Value

FLOAT | DOUBLE

SQL examples

array_distance(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_distance(), array_cosine_similarity(), array_cross_product(), array_inner_product(), array_negative_inner_product(), array_value()


DuckDB function array_extract

Description

  • array_extract(list = `T[]`, index = BIGINT): Extracts the indexth (1-based) value from the list.

  • array_extract(string = VARCHAR, index = BIGINT): Extracts a single character from a string using a (1-based) index.

  • array_extract(struct = STRUCT, entry = VARCHAR): Extracts the named entry from the STRUCT.

  • array_extract(struct = STRUCT, index = BIGINT): Extracts the entry from an unnamed STRUCT (tuple) using an index (1-based).

Usage

array_extract(list, index)

Arguments

list

T[]

index

BIGINT

Value

T | VARCHAR | ANY

Overloads

  • array_extract(list = `T[]`, index = BIGINT)

  • array_extract(string = VARCHAR, index = BIGINT)

  • array_extract(struct = STRUCT, entry = VARCHAR)

  • array_extract(struct = STRUCT, index = BIGINT)

SQL examples

array_extract('DuckDB', 2)
array_extract({'i': 3, 'v2': 3, 'v3': 0}, 'i')
array_extract(row(42, 84), 1)
array_extract([4, 5, 6], 3)

See Also

Other list: array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()

Other string: ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function array_inner_product

Description

Computes the inner product between two arrays of the same size. The array elements can not be NULL. The arrays can have any size as long as the size is the same for both arguments.

Usage

array_inner_product(array1, array2)

Arguments

array1, array2

FLOAT[ANY] | DOUBLE[ANY]

Value

FLOAT | DOUBLE

SQL examples

array_inner_product(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_distance(), array_cosine_similarity(), array_cross_product(), array_distance(), array_negative_inner_product(), array_value()


DuckDB function array_length

Description

  • array_length(list = `ANY[]`): Returns the length of the list.

  • array_length(list = `ANY[]`, dimension = BIGINT): array_length for lists with dimensions other than 1 not implemented.

Usage

array_length(list, dimension)

Arguments

list

ANY[]

dimension

BIGINT

Value

BIGINT

Overloads

  • array_length(list = `ANY[]`)

  • array_length(list = `ANY[]`, dimension = BIGINT)

SQL examples

array_length([1, 2, 3])

See Also

Other list: array_extract(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function array_negative_inner_product

Description

Computes the negative inner product between two arrays of the same size. The array elements can not be NULL. The arrays can have any size as long as the size is the same for both arguments.

Usage

array_negative_inner_product(array1, array2)

Arguments

array1, array2

FLOAT[ANY] | DOUBLE[ANY]

Value

FLOAT | DOUBLE

SQL examples

array_negative_inner_product(array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT), array_value(2.0::FLOAT, 3.0::FLOAT, 4.0::FLOAT))

See Also

Other array: array_cosine_distance(), array_cosine_similarity(), array_cross_product(), array_distance(), array_inner_product(), array_value()


DuckDB function array_pop_back

Description

DuckDB macro array_pop_back().

Usage

array_pop_back(arr)

Arguments

arr

Unspecified.

Value

Unspecified.


DuckDB function array_pop_front

Description

DuckDB macro array_pop_front().

Usage

array_pop_front(arr)

Arguments

arr

Unspecified.

Value

Unspecified.


DuckDB function array_prepend

Description

DuckDB macro array_prepend().

Usage

array_prepend(el, arr)

Arguments

el, arr

Unspecified.

Value

Unspecified.


DuckDB function array_push_back

Description

DuckDB macro array_push_back().

Usage

array_push_back(arr, e)

Arguments

arr, e

Unspecified.

Value

Unspecified.


DuckDB function array_push_front

Description

DuckDB macro array_push_front().

Usage

array_push_front(arr, e)

Arguments

arr, e

Unspecified.

Value

Unspecified.


DuckDB function array_reverse

Description

DuckDB macro array_reverse().

Usage

array_reverse(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function array_to_json

Description

DuckDB function array_to_json().

Usage

array_to_json()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function array_to_string

Description

DuckDB macro array_to_string().

Usage

array_to_string(arr, sep)

Arguments

arr, sep

Unspecified.

Value

Unspecified.


DuckDB function array_to_string_comma_default

Description

DuckDB macro array_to_string_comma_default().

Usage

array_to_string_comma_default(arr, sep)

Arguments

arr, sep

Unspecified.

Value

Unspecified.


DuckDB function array_value

Description

Creates an ARRAY containing the argument values.

Usage

array_value()

Value

ARRAY

SQL examples

array_value(1.0::FLOAT, 2.0::FLOAT, 3.0::FLOAT)

See Also

Other array: array_cosine_distance(), array_cosine_similarity(), array_cross_product(), array_distance(), array_inner_product(), array_negative_inner_product()


DuckDB function arrow_scan

Description

DuckDB function arrow_scan().

Usage

arrow_scan(col0, col1, col2)

Arguments

col0, col1, col2

POINTER

Value

Unspecified.


DuckDB function arrow_scan_dumb

Description

DuckDB function arrow_scan_dumb().

Usage

arrow_scan_dumb(col0, col1, col2)

Arguments

col0, col1, col2

POINTER

Value

Unspecified.


DuckDB function ->>

Description

DuckDB function ⁠->>()⁠.

Usage

`->>`(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

VARCHAR | VARCHAR[]

Provided by

The json extension (LOAD json;).


DuckDB function asin

Description

Computes the arcsine of x.

Usage

asin(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

asin(0.5)

DuckDB function asinh

Description

Computes the inverse hyperbolic sin of x.

Usage

asinh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

asinh(0.5)

DuckDB function atan

Description

Computes the arctangent of x.

Usage

atan(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

atan(0.5)

DuckDB function atan2

Description

Computes the arctangent (y, x).

Usage

atan2(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

atan2(1.0, 0.0)

DuckDB function atanh

Description

Computes the inverse hyperbolic tan of x.

Usage

atanh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

atanh(0.5)

DuckDB function avg

Description

Calculates the average value for all tuples in x.

Usage

avg(x)

Arguments

x

⁠DECIMAL | SMALLINT | INTEGER | BIGINT | HUGEINT | INTERVAL | DOUBLE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TIME | TIME WITH TIME ZONE⁠

Value

⁠DECIMAL | DOUBLE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TIME | TIME WITH TIME ZONE⁠

SQL examples

SUM(x) / COUNT(*)

DuckDB function bar

Description

Draws a band whose width is proportional to (x - min) and equal to width characters when x = max. width defaults to 80.

Usage

bar(x, min, max, width)

Arguments

x, min, max, width

DOUBLE

Value

VARCHAR

Overloads

  • bar(x = DOUBLE, min = DOUBLE, max = DOUBLE, width = DOUBLE)

  • bar(x = DOUBLE, min = DOUBLE, max = DOUBLE)

SQL examples

bar(5, 0, 20, 10)

See Also

Other string: array_extract(), ascii(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function bin

Description

  • bin(string = VARCHAR): Converts the string to binary representation.

  • bin(value = BIGNUM), bin(value = UBIGINT), bin(value = BIGINT), bin(value = HUGEINT), bin(value = UHUGEINT): Converts the value to binary representation.

Usage

bin(value)

Arguments

value

BIGNUM | UBIGINT | BIGINT | HUGEINT | UHUGEINT

Value

VARCHAR

Overloads

  • bin(string = VARCHAR)

  • bin(value = BIGNUM)

  • bin(value = UBIGINT)

  • bin(value = BIGINT)

  • bin(value = HUGEINT)

  • bin(value = UHUGEINT)

SQL examples

bin('Aa')
bin(42)

See Also

Other numeric: bit_length(), formatReadableDecimalSize(), format_bytes(), greatest(), hex(), least(), len(), parse_formatted_bytes(), to_base()

Other string: array_extract(), ascii(), bar(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function bit_and

Description

Returns the bitwise AND of all bits in a given expression.

Usage

bit_and(arg)

Arguments

arg

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

bit_and(A)

DuckDB function bit_count

Description

Returns the number of bits that are set.

Usage

bit_count(x)

Arguments

x

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | BIT

Value

TINYINT | BIGINT

SQL examples

bit_count(31)

DuckDB function bit_or

Description

Returns the bitwise OR of all bits in a given expression.

Usage

bit_or(arg)

Arguments

arg

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

bit_or(A)

DuckDB function bit_position

Description

Returns first starting index of the specified substring within bits, or zero if it is not present. The first (leftmost) bit is indexed 1.

Usage

bit_position(substring, bitstring)

Arguments

substring, bitstring

BIT

Value

INTEGER

SQL examples

bit_position('010'::BIT, '1110101'::BIT)

DuckDB function bit_xor

Description

Returns the bitwise XOR of all bits in a given expression.

Usage

bit_xor(arg)

Arguments

arg

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

bit_xor(A)

DuckDB function bitstring

Description

Pads the bitstring until the specified length.

Usage

bitstring(bitstring, length)

Arguments

bitstring

VARCHAR | BIT

length

INTEGER

Value

BIT

SQL examples

bitstring('1010'::BIT, 7)

DuckDB function bitstring_agg

Description

Returns a bitstring with bits set for each distinct value.

Usage

bitstring_agg(arg, col1, col2)

Arguments

arg, col1, col2

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

BIT

Overloads

  • bitstring_agg(arg = TINYINT)

  • bitstring_agg(arg = TINYINT, col1 = TINYINT, col2 = TINYINT)

  • bitstring_agg(arg = SMALLINT)

  • bitstring_agg(arg = SMALLINT, col1 = SMALLINT, col2 = SMALLINT)

  • bitstring_agg(arg = INTEGER)

  • bitstring_agg(arg = INTEGER, col1 = INTEGER, col2 = INTEGER)

  • bitstring_agg(arg = BIGINT)

  • bitstring_agg(arg = BIGINT, col1 = BIGINT, col2 = BIGINT)

  • bitstring_agg(arg = HUGEINT)

  • bitstring_agg(arg = HUGEINT, col1 = HUGEINT, col2 = HUGEINT)

  • bitstring_agg(arg = UTINYINT)

  • bitstring_agg(arg = UTINYINT, col1 = UTINYINT, col2 = UTINYINT)

  • bitstring_agg(arg = USMALLINT)

  • bitstring_agg(arg = USMALLINT, col1 = USMALLINT, col2 = USMALLINT)

  • bitstring_agg(arg = UINTEGER)

  • bitstring_agg(arg = UINTEGER, col1 = UINTEGER, col2 = UINTEGER)

  • bitstring_agg(arg = UBIGINT)

  • bitstring_agg(arg = UBIGINT, col1 = UBIGINT, col2 = UBIGINT)

  • bitstring_agg(arg = UHUGEINT)

  • bitstring_agg(arg = UHUGEINT, col1 = UHUGEINT, col2 = UHUGEINT)

SQL examples

bitstring_agg(A)

DuckDB function bool_and

Description

Returns TRUE if every input value is TRUE, otherwise FALSE.

Usage

bool_and(arg)

Arguments

arg

BOOLEAN

Value

BOOLEAN

SQL examples

bool_and(A)

DuckDB function bool_or

Description

Returns TRUE if any input value is TRUE, otherwise FALSE.

Usage

bool_or(arg)

Arguments

arg

BOOLEAN

Value

BOOLEAN

SQL examples

bool_or(A)

DuckDB function broadcast

Description

DuckDB function broadcast().

Usage

broadcast(col0)

Arguments

col0

INET

Value

INET

Provided by

The inet extension (LOAD inet;).


DuckDB function can_cast_implicitly

Description

Whether or not we can implicitly cast from the source type to the other type.

Usage

can_cast_implicitly(source_type, target_type)

Arguments

source_type, target_type

ANY

Value

BOOLEAN

SQL examples

can_cast_implicitly(NULL::INTEGER, NULL::BIGINT)

DuckDB function cardinality

Description

Returns the size of the map (or the number of entries in the map).

Usage

cardinality(map)

Arguments

map

ANY

Value

UBIGINT

SQL examples

cardinality( map([4, 2], ['a', 'b']) );

DuckDB function cast_to_type

Description

Casts the first argument to the type of the second argument.

Usage

cast_to_type(param, type)

Arguments

param, type

ANY

Value

ANY

SQL examples

cast_to_type('42', NULL::INTEGER)

DuckDB function cbrt

Description

Returns the cube root of x.

Usage

cbrt(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

cbrt(8)

DuckDB function ceil

Description

Rounds the number up.

Usage

ceil(x)

Arguments

x

FLOAT | DOUBLE | DECIMAL

Value

FLOAT | DOUBLE | DECIMAL

SQL examples

ceil(17.4)

DuckDB function century

Description

Extract the century component from a date or timestamp.

Usage

century(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

century(timestamp '2021-08-03 11:59:44.123456')

DuckDB function check_peg_parser

Description

DuckDB function check_peg_parser().

Usage

check_peg_parser(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The autocomplete extension (LOAD autocomplete;).


DuckDB function checkpoint

Description

DuckDB function checkpoint().

Usage

checkpoint(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Overloads

  • checkpoint()

  • checkpoint(col0 = VARCHAR)


DuckDB function col_description

Description

DuckDB macro col_description().

Usage

col_description(table_oid, column_number)

Arguments

table_oid, column_number

Unspecified.

Value

Unspecified.


DuckDB function collations

Description

DuckDB function collations().

Usage

collations()

Value

Unspecified.


DuckDB function combine

Description

DuckDB function combine().

Usage

combine(col0, col1)

Arguments

col0

⁠AGGREGATE_STATE<?>⁠

col1

ANY

Value

⁠AGGREGATE_STATE<?>⁠


DuckDB function concat

Description

Concatenates multiple strings or lists. NULL inputs are skipped. See also operator ||.

Usage

concat(value)

Arguments

value

ANY

Value

ANY

SQL examples

concat('Hello', ' ', 'World')
concat([1, 2, 3], NULL, [4, 5, 6])

See Also

Other list: array_extract(), array_length(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function constant_or_null

Description

If arg2 is NULL, return NULL. Otherwise, return arg1.

Usage

constant_or_null(arg1, arg2)

Arguments

arg1, arg2

ANY

Value

ANY

SQL examples

constant_or_null(42, NULL)

DuckDB function contains

Description

  • contains(string = VARCHAR, search_string = VARCHAR): Returns true if search_string is found within string.

  • contains(list = `T[]`, element = T): Returns true if the list contains the element.

  • contains(map = `MAP(K, V)`, key = K): Checks if a map contains a given key.

  • contains(col0 = STRUCT, col1 = ANY): (Description missing.)

Usage

contains(string, search_string)

Arguments

string, search_string

VARCHAR

Value

BOOLEAN

Overloads

  • contains(string = VARCHAR, search_string = VARCHAR)

  • contains(list = `T[]`, element = T)

  • contains(map = `MAP(K, V)`, key = K)

  • contains(col0 = STRUCT, col1 = ANY)

SQL examples

contains('abc', 'a')
contains([1, 2, NULL], 1)
contains(MAP {'key1': 10, 'key2': 20, 'key3': 30}, 'key2')

See Also

Other list: array_extract(), array_length(), concat(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function copy_database

Description

DuckDB function copy_database().

Usage

copy_database(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.


DuckDB function copy_dir

Description

DuckDB macro copy_dir().

Usage

copy_dir(src_dir, dst_dir)

Arguments

src_dir, dst_dir

Unspecified.

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function corr

Description

Returns the correlation coefficient for non-NULL pairs in a group.

Usage

corr(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

COVAR_POP(y, x) / (STDDEV_POP(x) * STDDEV_POP(y))

DuckDB function cos

Description

Computes the cos of x.

Usage

cos(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

cos(90)

DuckDB function cosh

Description

Computes the hyperbolic cos of x.

Usage

cosh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

cosh(1)

DuckDB function cot

Description

Computes the cotangent of x.

Usage

cot(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

cot(0.5)

DuckDB function count

Description

Returns the number of non-NULL values in arg.

Usage

count(arg)

Arguments

arg

ANY

Value

BIGINT

Overloads

  • count(arg = ANY)

  • count()

SQL examples

count(A)

DuckDB function count_if

Description

Counts the total number of TRUE values for a boolean column.

Usage

count_if(arg)

Arguments

arg

BOOLEAN

Value

HUGEINT

SQL examples

count_if(A)

DuckDB function count_star

Description

DuckDB function count_star().

Usage

count_star()

Value

BIGINT


DuckDB function covar_pop

Description

Returns the population covariance of input values.

Usage

covar_pop(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

(SUM(x*y) - SUM(x) * SUM(y) / COUNT(*)) / COUNT(*)

DuckDB function covar_samp

Description

Returns the sample covariance for non-NULL pairs in a group.

Usage

covar_samp(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

(SUM(x*y) - SUM(x) * SUM(y) / COUNT(*)) / (COUNT(*) - 1)

DuckDB function create_fts_index

Description

DuckDB function create_fts_index().

Usage

create_fts_index(col0, col1, overwrite, lower, ignore, stopwords, strip_accents, stemmer)

Arguments

col0

VARCHAR

col1

VARCHAR

overwrite

BOOLEAN

lower

BOOLEAN

ignore

VARCHAR

stopwords

VARCHAR

strip_accents

BOOLEAN

stemmer

VARCHAR

Value

Unspecified.

Provided by

The fts extension (LOAD fts;).


DuckDB function create_sort_key

Description

Constructs a binary-comparable sort key based on a set of input parameters and sort qualifiers.

Usage

create_sort_key(parameters...)

Arguments

parameters...

ANY

Value

BLOB

SQL examples

create_sort_key('A', 'DESC')

DuckDB function cume_dist

Description

DuckDB function cume_dist().

Usage

cume_dist()

Value

DOUBLE


DuckDB function current_catalog

Description

DuckDB macro current_catalog().

Usage

current_catalog()

Value

Unspecified.


DuckDB function current_connection_id

Description

Get the current connection_id.

Usage

current_connection_id()

Value

UBIGINT

SQL examples

current_connection_id()

DuckDB function current_database

Description

Returns the name of the currently active database.

Usage

current_database()

Value

VARCHAR

SQL examples

current_database()

DuckDB function current_date

Description

DuckDB function current_date().

Usage

current_date()

Value

DATE

Provided by

The icu extension (LOAD icu;).


DuckDB function current_localtime

Description

DuckDB function current_localtime().

Usage

current_localtime()

Value

TIME

Provided by

The icu extension (LOAD icu;).


DuckDB function current_localtimestamp

Description

DuckDB function current_localtimestamp().

Usage

current_localtimestamp()

Value

TIMESTAMP

Provided by

The icu extension (LOAD icu;).


DuckDB function current_query

Description

Returns the current query as a string.

Usage

current_query()

Value

VARCHAR

SQL examples

current_query()

DuckDB function current_query_id

Description

Get the current query_id.

Usage

current_query_id()

Value

UBIGINT

SQL examples

current_query_id()

DuckDB function current_role

Description

DuckDB macro current_role().

Usage

current_role()

Value

Unspecified.


DuckDB function current_schema

Description

Returns the name of the currently active schema. Default is main.

Usage

current_schema()

Value

VARCHAR

SQL examples

current_schema()

DuckDB function current_schemas

Description

Returns list of schemas. Pass a parameter of True to include implicit schemas.

Usage

current_schemas(include_implicit)

Arguments

include_implicit

BOOLEAN

Value

VARCHAR[]

SQL examples

current_schemas(true)

DuckDB function current_setting

Description

Returns the current value of the configuration setting.

Usage

current_setting(setting_name)

Arguments

setting_name

VARCHAR

Value

ANY

SQL examples

current_setting('access_mode')

DuckDB function current_transaction_id

Description

Get the current global transaction_id.

Usage

current_transaction_id()

Value

UBIGINT

SQL examples

current_transaction_id()

DuckDB function current_user

Description

DuckDB macro current_user().

Usage

current_user()

Value

Unspecified.


DuckDB function currval

Description

Return the current value of the sequence. Note that nextval must be called at least once prior to calling currval.

Usage

currval(sequence_name)

Arguments

sequence_name

VARCHAR

Value

BIGINT

SQL examples

currval('my_sequence_name')

DuckDB function damerau_levenshtein

Description

Extension of Levenshtein distance to also include transposition of adjacent characters as an allowed edit operation. In other words, the minimum number of edit operations (insertions, deletions, substitutions or transpositions) required to change one string to another. Characters of different cases (e.g., a and A) are considered different.

Usage

damerau_levenshtein(s1, s2)

Arguments

s1, s2

VARCHAR

Value

BIGINT

SQL examples

damerau_levenshtein('duckdb', 'udckbd')

See Also

Other text_similarity: hamming(), jaccard(), jaro_similarity(), jaro_winkler_similarity(), levenshtein()


DuckDB function database_list

Description

DuckDB function database_list().

Usage

database_list()

Value

Unspecified.


DuckDB function database_size

Description

DuckDB function database_size().

Usage

database_size()

Value

Unspecified.


DuckDB function date_add

Description

DuckDB macro date_add().

Usage

date_add(date, interval)

Arguments

date, interval

Unspecified.

Value

Unspecified.


DuckDB function date_diff

Description

The number of partition boundaries between the timestamps.

Usage

date_diff(part, startdate, enddate)

Arguments

part

VARCHAR

startdate

⁠DATE | TIME | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

enddate

⁠DATE | TIME | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

date_diff('hour', TIMESTAMPTZ '1992-09-30 23:59:59', TIMESTAMPTZ '1992-10-01 01:58:00')

DuckDB function date_part

Description

Get subfield (equivalent to extract).

Usage

date_part(ts, col1)

Arguments

ts

VARCHAR[] | VARCHAR

col1

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

STRUCT() | BIGINT

SQL examples

date_part('minute', TIMESTAMP '1992-09-20 20:38:40')

DuckDB function date_sub

Description

The number of complete partitions between the timestamps.

Usage

date_sub(part, startdate, enddate)

Arguments

part

VARCHAR

startdate

⁠DATE | TIME | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

enddate

⁠DATE | TIME | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

date_sub('hour', TIMESTAMPTZ '1992-09-30 23:59:59', TIMESTAMPTZ '1992-10-01 01:58:00')

DuckDB function date_trunc

Description

Truncate to specified precision.

Usage

date_trunc(part, timestamp)

Arguments

part

VARCHAR

timestamp

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

⁠TIMESTAMP | INTERVAL | TIMESTAMP WITH TIME ZONE⁠

SQL examples

date_trunc('hour', TIMESTAMPTZ '1992-09-20 20:38:40')

DuckDB function day

Description

Extract the day component from a date or timestamp.

Usage

day(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

day(timestamp '2021-08-03 11:59:44.123456')

DuckDB function dayname

Description

The (English) name of the weekday.

Usage

dayname(ts)

Arguments

ts

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

VARCHAR

SQL examples

dayname(TIMESTAMP '1992-03-22')

DuckDB function dayofmonth

Description

Extract the dayofmonth component from a date or timestamp.

Usage

dayofmonth(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

dayofmonth(timestamp '2021-08-03 11:59:44.123456')

DuckDB function dayofweek

Description

Extract the dayofweek component from a date or timestamp.

Usage

dayofweek(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

dayofweek(timestamp '2021-08-03 11:59:44.123456')

DuckDB function dayofyear

Description

Extract the dayofyear component from a date or timestamp.

Usage

dayofyear(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

dayofyear(timestamp '2021-08-03 11:59:44.123456')

DuckDB function days_in_month

Description

DuckDB macro days_in_month().

Usage

days_in_month(date)

Arguments

date

Unspecified.

Value

Unspecified.


DuckDB function dbgen

Description

DuckDB function dbgen().

Usage

dbgen(step, suffix, schema, catalog, overwrite, children, sf)

Arguments

step

UINTEGER

suffix

VARCHAR

schema

VARCHAR

catalog

VARCHAR

overwrite

BOOLEAN

children

UINTEGER

sf

DOUBLE

Value

Unspecified.

Provided by

The tpch extension (LOAD tpch;).


DuckDB functions

Description

A list of known DuckDB functions, as provided by DuckDB 1.5.5.

Usage

dd

Examples

dd[1:3]

DuckDB function decade

Description

Extract the decade component from a date or timestamp.

Usage

decade(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

decade(timestamp '2021-08-03 11:59:44.123456')

DuckDB function decode

Description

Converts blob to VARCHAR. Invalid UTF-8 is handled based on the error behavior argument. Can be 'strict' (default, fail), 'replace' to replace invalid characters with '?', or 'ignore' to skip invalid characters.

Usage

decode(blob, varchar)

Arguments

blob

BLOB

varchar

VARCHAR

Value

VARCHAR

Overloads

  • decode(blob = BLOB)

  • decode(blob = BLOB, varchar = VARCHAR)

SQL examples

decode('\xC3\xBC'::BLOB)
decode('\xA0'::BLOB, 'replace')
decode('\xA0'::BLOB, 'ignore')

See Also

Other blob: encode(), from_base64(), hex(), md5(), md5_number(), octet_length(), or–or, repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()


DuckDB function degrees

Description

Converts radians to degrees.

Usage

degrees(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

degrees(pi())

DuckDB function delta_domain_metadata

Description

DuckDB function delta_domain_metadata().

Usage

delta_domain_metadata(col0, version)

Arguments

col0

VARCHAR

version

UBIGINT

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_filter_pushdown_log

Description

DuckDB macro delta_filter_pushdown_log().

Usage

delta_filter_pushdown_log()

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_filter_pushdown_log_tpcds

Description

DuckDB macro delta_filter_pushdown_log_tpcds().

Usage

delta_filter_pushdown_log_tpcds()

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_get_transaction_version

Description

DuckDB function delta_get_transaction_version().

Usage

delta_get_transaction_version(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_list_files

Description

DuckDB function delta_list_files().

Usage

delta_list_files(col0, version, delete_count, transform_expression)

Arguments

col0

VARCHAR

version

UBIGINT

delete_count

BOOLEAN

transform_expression

BOOLEAN

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_scan

Description

DuckDB function delta_scan().

Usage

delta_scan(
  col0,
  version,
  log_tail,
  pushdown_partition_info,
  can_have_nan,
  filename,
  pushdown_filters,
  union_by_name,
  debug_use_openssl,
  hive_partitioning,
  parquet_version,
  encryption_config,
  hive_types_autocast,
  binary_as_string,
  explicit_cardinality,
  compression,
  file_row_number,
  hive_types
)

Arguments

col0

VARCHAR | VARCHAR[]

version

UBIGINT

log_tail

⁠STRUCT(file_name VARCHAR, "timestamp" BIGINT, file_size UBIGINT)[]⁠

pushdown_partition_info

BOOLEAN

can_have_nan

BOOLEAN

filename

ANY

pushdown_filters

VARCHAR

union_by_name

BOOLEAN

debug_use_openssl

BOOLEAN

hive_partitioning

BOOLEAN

parquet_version

VARCHAR

encryption_config

ANY

hive_types_autocast

BOOLEAN

binary_as_string

BOOLEAN

explicit_cardinality

UBIGINT

compression

VARCHAR

file_row_number

BOOLEAN

hive_types

ANY

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function delta_set_transaction_version

Description

DuckDB function delta_set_transaction_version().

Usage

delta_set_transaction_version(col0, col1, col2, col3)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

UBIGINT

col3

UBIGINT

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function dense_rank

Description

DuckDB function dense_rank().

Usage

dense_rank()

Value

BIGINT


DuckDB function disable_checkpoint_on_shutdown

Description

DuckDB function disable_checkpoint_on_shutdown().

Usage

disable_checkpoint_on_shutdown()

Value

Unspecified.


DuckDB function disable_logging

Description

DuckDB function disable_logging().

Usage

disable_logging()

Value

Unspecified.


DuckDB function disable_object_cache

Description

DuckDB function disable_object_cache().

Usage

disable_object_cache()

Value

Unspecified.


DuckDB function disable_optimizer

Description

DuckDB function disable_optimizer().

Usage

disable_optimizer()

Value

Unspecified.


DuckDB function disable_peg_parser

Description

DuckDB function disable_peg_parser().

Usage

disable_peg_parser()

Value

Unspecified.

Provided by

The autocomplete extension (LOAD autocomplete;).


DuckDB function disable_print_progress_bar

Description

DuckDB function disable_print_progress_bar().

Usage

disable_print_progress_bar()

Value

Unspecified.


DuckDB function disable_profile

Description

DuckDB function disable_profile().

Usage

disable_profile()

Value

Unspecified.


DuckDB function disable_profiling

Description

DuckDB function disable_profiling().

Usage

disable_profiling()

Value

Unspecified.


DuckDB function disable_progress_bar

Description

DuckDB function disable_progress_bar().

Usage

disable_progress_bar()

Value

Unspecified.


DuckDB function disable_verification

Description

DuckDB function disable_verification().

Usage

disable_verification()

Value

Unspecified.


DuckDB function disable_verify_external

Description

DuckDB function disable_verify_external().

Usage

disable_verify_external()

Value

Unspecified.


DuckDB function disable_verify_fetch_row

Description

DuckDB function disable_verify_fetch_row().

Usage

disable_verify_fetch_row()

Value

Unspecified.


DuckDB function disable_verify_parallelism

Description

DuckDB function disable_verify_parallelism().

Usage

disable_verify_parallelism()

Value

Unspecified.


DuckDB function disable_verify_serializer

Description

DuckDB function disable_verify_serializer().

Usage

disable_verify_serializer()

Value

Unspecified.


DuckDB function divide

Description

DuckDB function divide().

Usage

divide(col0, col1)

Arguments

col0, col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT


DuckDB function drop_fts_index

Description

DuckDB function drop_fts_index().

Usage

drop_fts_index(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The fts extension (LOAD fts;).


DuckDB function dsdgen

Description

DuckDB function dsdgen().

Usage

dsdgen(suffix, schema, catalog, keys, overwrite, sf)

Arguments

suffix

VARCHAR

schema

VARCHAR

catalog

VARCHAR

keys

BOOLEAN

overwrite

BOOLEAN

sf

DOUBLE

Value

Unspecified.

Provided by

The tpcds extension (LOAD tpcds;).


DuckDB function duckdb_approx_database_count

Description

DuckDB function duckdb_approx_database_count().

Usage

duckdb_approx_database_count()

Value

Unspecified.


DuckDB function duckdb_columns

Description

DuckDB function duckdb_columns().

Usage

duckdb_columns()

Value

Unspecified.


DuckDB function duckdb_connection_count

Description

DuckDB function duckdb_connection_count().

Usage

duckdb_connection_count()

Value

Unspecified.


DuckDB function duckdb_constraints

Description

DuckDB function duckdb_constraints().

Usage

duckdb_constraints()

Value

Unspecified.


DuckDB function duckdb_coordinate_systems

Description

DuckDB function duckdb_coordinate_systems().

Usage

duckdb_coordinate_systems()

Value

Unspecified.


DuckDB function duckdb_databases

Description

DuckDB function duckdb_databases().

Usage

duckdb_databases()

Value

Unspecified.


DuckDB function duckdb_dependencies

Description

DuckDB function duckdb_dependencies().

Usage

duckdb_dependencies()

Value

Unspecified.


DuckDB function duckdb_extensions

Description

DuckDB function duckdb_extensions().

Usage

duckdb_extensions()

Value

Unspecified.


DuckDB function duckdb_external_file_cache

Description

DuckDB function duckdb_external_file_cache().

Usage

duckdb_external_file_cache()

Value

Unspecified.


DuckDB function duckdb_functions

Description

DuckDB function duckdb_functions().

Usage

duckdb_functions()

Value

Unspecified.


DuckDB function duckdb_indexes

Description

DuckDB function duckdb_indexes().

Usage

duckdb_indexes()

Value

Unspecified.


DuckDB function duckdb_keywords

Description

DuckDB function duckdb_keywords().

Usage

duckdb_keywords()

Value

Unspecified.


DuckDB function duckdb_log_contexts

Description

DuckDB function duckdb_log_contexts().

Usage

duckdb_log_contexts()

Value

Unspecified.


DuckDB function duckdb_logs

Description

DuckDB function duckdb_logs().

Usage

duckdb_logs(denormalized_table)

Arguments

denormalized_table

BOOLEAN

Value

Unspecified.


DuckDB function duckdb_logs_parsed

Description

DuckDB macro duckdb_logs_parsed().

Usage

duckdb_logs_parsed(log_type)

Arguments

log_type

Unspecified.

Value

Unspecified.


DuckDB function duckdb_memory

Description

DuckDB function duckdb_memory().

Usage

duckdb_memory()

Value

Unspecified.


DuckDB function duckdb_optimizers

Description

DuckDB function duckdb_optimizers().

Usage

duckdb_optimizers()

Value

Unspecified.


DuckDB function duckdb_prepared_statements

Description

DuckDB function duckdb_prepared_statements().

Usage

duckdb_prepared_statements()

Value

Unspecified.


DuckDB function duckdb_profiling_settings

Description

DuckDB macro duckdb_profiling_settings().

Usage

duckdb_profiling_settings()

Value

Unspecified.


DuckDB function DuckDB_PROJ_Compiled_Version

Description

Returns a text description of the PROJ library version that this instance of DuckDB was compiled against.

Usage

DuckDB_PROJ_Compiled_Version()

Value

VARCHAR

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT duckdb_proj_compiled_version();
-- +--------------------------------+
-- | duckdb_proj_compiled_version() |
-- |            varchar             |
-- +--------------------------------+
-- | Rel. 9.1.1, December 1st, 2022 |
-- +--------------------------------+

DuckDB function DuckDB_Proj_Version

Description

Returns a text description of the PROJ library version that is being used by this instance of DuckDB.

Usage

DuckDB_Proj_Version()

Value

VARCHAR

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT duckdb_proj_version();
-- +-----------------------+
-- | duckdb_proj_version() |
-- |        varchar        |
-- +-----------------------+
-- | 9.1.1                 |geometry_always_xy
-- +-----------------------+

DuckDB function duckdb_schemas

Description

DuckDB function duckdb_schemas().

Usage

duckdb_schemas()

Value

Unspecified.


DuckDB function duckdb_secret_types

Description

DuckDB function duckdb_secret_types().

Usage

duckdb_secret_types()

Value

Unspecified.


DuckDB function duckdb_secrets

Description

DuckDB function duckdb_secrets().

Usage

duckdb_secrets(redact)

Arguments

redact

BOOLEAN

Value

Unspecified.


DuckDB function duckdb_sequences

Description

DuckDB function duckdb_sequences().

Usage

duckdb_sequences()

Value

Unspecified.


DuckDB function duckdb_settings

Description

DuckDB function duckdb_settings().

Usage

duckdb_settings()

Value

Unspecified.


DuckDB function duckdb_table_sample

Description

DuckDB function duckdb_table_sample().

Usage

duckdb_table_sample(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function duckdb_tables

Description

DuckDB function duckdb_tables().

Usage

duckdb_tables()

Value

Unspecified.


DuckDB function duckdb_temporary_files

Description

DuckDB function duckdb_temporary_files().

Usage

duckdb_temporary_files()

Value

Unspecified.


DuckDB function duckdb_types

Description

DuckDB function duckdb_types().

Usage

duckdb_types()

Value

Unspecified.


DuckDB function duckdb_variables

Description

DuckDB function duckdb_variables().

Usage

duckdb_variables()

Value

Unspecified.


DuckDB function duckdb_views

Description

DuckDB function duckdb_views().

Usage

duckdb_views()

Value

Unspecified.


DuckDB function ducklake_add_data_files

Description

DuckDB function ducklake_add_data_files().

Usage

ducklake_add_data_files(
  col0,
  col1,
  col2,
  schema,
  hive_partitioning,
  ignore_extra_columns,
  allow_missing
)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

VARCHAR | VARCHAR[]

schema

VARCHAR

hive_partitioning

BOOLEAN

ignore_extra_columns

BOOLEAN

allow_missing

BOOLEAN

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_cleanup_old_files

Description

DuckDB function ducklake_cleanup_old_files().

Usage

ducklake_cleanup_old_files(col0, dry_run, cleanup_all, older_than)

Arguments

col0

VARCHAR

dry_run

BOOLEAN

cleanup_all

BOOLEAN

older_than

⁠TIMESTAMP WITH TIME ZONE⁠

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_commit

Description

DuckDB function ducklake_commit().

Usage

ducklake_commit(col0, col1, retry_backoff, retry_wait_ms, max_retry_count)

Arguments

col0

VARCHAR

col1

BIGINT

retry_backoff

DOUBLE

retry_wait_ms

BIGINT

max_retry_count

BIGINT

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_current_snapshot

Description

DuckDB function ducklake_current_snapshot().

Usage

ducklake_current_snapshot(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_delete_orphaned_files

Description

DuckDB function ducklake_delete_orphaned_files().

Usage

ducklake_delete_orphaned_files(col0, dry_run, cleanup_all, older_than)

Arguments

col0

VARCHAR

dry_run

BOOLEAN

cleanup_all

BOOLEAN

older_than

⁠TIMESTAMP WITH TIME ZONE⁠

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_expire_snapshots

Description

DuckDB function ducklake_expire_snapshots().

Usage

ducklake_expire_snapshots(col0, dry_run, versions, older_than)

Arguments

col0

VARCHAR

dry_run

BOOLEAN

versions

UBIGINT[]

older_than

⁠TIMESTAMP WITH TIME ZONE⁠

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_flush_inlined_data

Description

DuckDB function ducklake_flush_inlined_data().

Usage

ducklake_flush_inlined_data(col0, table_name, schema_name)

Arguments

col0, table_name, schema_name

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_last_committed_snapshot

Description

DuckDB function ducklake_last_committed_snapshot().

Usage

ducklake_last_committed_snapshot(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_list_files

Description

DuckDB function ducklake_list_files().

Usage

ducklake_list_files(col0, col1, snapshot_time, snapshot_version, schema)

Arguments

col0

VARCHAR

col1

VARCHAR

snapshot_time

⁠TIMESTAMP WITH TIME ZONE⁠

snapshot_version

BIGINT

schema

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_merge_adjacent_files

Description

DuckDB function ducklake_merge_adjacent_files().

Usage

ducklake_merge_adjacent_files(
  col0,
  col1,
  schema,
  max_compacted_files,
  max_file_size,
  min_file_size
)

Arguments

col0

VARCHAR

col1

VARCHAR

schema

VARCHAR

max_compacted_files

UBIGINT

max_file_size

UBIGINT

min_file_size

UBIGINT

Value

Unspecified.

Overloads

  • ducklake_merge_adjacent_files(col0 = VARCHAR, col1 = VARCHAR, schema = VARCHAR, max_compacted_files = UBIGINT, max_file_size = UBIGINT, min_file_size = UBIGINT)

  • ducklake_merge_adjacent_files(col0 = VARCHAR, max_compacted_files = UBIGINT, max_file_size = UBIGINT, min_file_size = UBIGINT)

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_options

Description

DuckDB function ducklake_options().

Usage

ducklake_options(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_rewrite_data_files

Description

DuckDB function ducklake_rewrite_data_files().

Usage

ducklake_rewrite_data_files(col0, col1, schema, delete_threshold)

Arguments

col0

VARCHAR

col1

VARCHAR

schema

VARCHAR

delete_threshold

DOUBLE

Value

Unspecified.

Overloads

  • ducklake_rewrite_data_files(col0 = VARCHAR, col1 = VARCHAR, schema = VARCHAR, delete_threshold = DOUBLE)

  • ducklake_rewrite_data_files(col0 = VARCHAR, delete_threshold = DOUBLE)

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_scan

Description

DuckDB function ducklake_scan().

Usage

ducklake_scan(
  col0,
  can_have_nan,
  filename,
  union_by_name,
  debug_use_openssl,
  hive_partitioning,
  parquet_version,
  encryption_config,
  hive_types_autocast,
  binary_as_string,
  explicit_cardinality,
  compression,
  file_row_number,
  hive_types,
  schema
)

Arguments

col0

VARCHAR

can_have_nan

BOOLEAN

filename

ANY

union_by_name

BOOLEAN

debug_use_openssl

BOOLEAN

hive_partitioning

BOOLEAN

parquet_version

VARCHAR

encryption_config

ANY

hive_types_autocast

BOOLEAN

binary_as_string

BOOLEAN

explicit_cardinality

UBIGINT

compression

VARCHAR

file_row_number

BOOLEAN

hive_types

ANY

schema

ANY

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_set_commit_message

Description

DuckDB function ducklake_set_commit_message().

Usage

ducklake_set_commit_message(col0, col1, col2, extra_info)

Arguments

col0, col1, col2, extra_info

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_set_option

Description

DuckDB function ducklake_set_option().

Usage

ducklake_set_option(col0, col1, col2, schema, table_name)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

ANY

schema

VARCHAR

table_name

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_settings

Description

DuckDB function ducklake_settings().

Usage

ducklake_settings(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_snapshots

Description

DuckDB function ducklake_snapshots().

Usage

ducklake_snapshots(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_table_changes

Description

DuckDB macro ducklake_table_changes().

Usage

ducklake_table_changes(catalog, schema_name, table_name, start_snapshot, end_snapshot)

Arguments

catalog, schema_name, table_name, start_snapshot, end_snapshot

Unspecified.

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_table_deletions

Description

DuckDB function ducklake_table_deletions().

Usage

ducklake_table_deletions(col0, col1, col2, col3, col4)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

VARCHAR

col3

⁠BIGINT | TIMESTAMP WITH TIME ZONE⁠

col4

⁠BIGINT | TIMESTAMP WITH TIME ZONE⁠

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_table_info

Description

DuckDB function ducklake_table_info().

Usage

ducklake_table_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function ducklake_table_insertions

Description

DuckDB function ducklake_table_insertions().

Usage

ducklake_table_insertions(col0, col1, col2, col3, col4)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

VARCHAR

col3

⁠BIGINT | TIMESTAMP WITH TIME ZONE⁠

col4

⁠BIGINT | TIMESTAMP WITH TIME ZONE⁠

Value

Unspecified.

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function enable_checkpoint_on_shutdown

Description

DuckDB function enable_checkpoint_on_shutdown().

Usage

enable_checkpoint_on_shutdown()

Value

Unspecified.


DuckDB function enable_logging

Description

DuckDB function enable_logging().

Usage

enable_logging(
  storage_buffer_size,
  storage_normalize,
  storage_path,
  storage_config,
  storage,
  level
)

Arguments

storage_buffer_size

UBIGINT

storage_normalize

BOOLEAN

storage_path

VARCHAR

storage_config

ANY

storage

VARCHAR

level

VARCHAR

Value

Unspecified.


DuckDB function enable_object_cache

Description

DuckDB function enable_object_cache().

Usage

enable_object_cache()

Value

Unspecified.


DuckDB function enable_optimizer

Description

DuckDB function enable_optimizer().

Usage

enable_optimizer()

Value

Unspecified.


DuckDB function enable_peg_parser

Description

DuckDB function enable_peg_parser().

Usage

enable_peg_parser()

Value

Unspecified.

Provided by

The autocomplete extension (LOAD autocomplete;).


DuckDB function enable_print_progress_bar

Description

DuckDB function enable_print_progress_bar().

Usage

enable_print_progress_bar()

Value

Unspecified.


DuckDB function enable_profile

Description

DuckDB function enable_profile().

Usage

enable_profile()

Value

Unspecified.


DuckDB function enable_profiling

Description

DuckDB function enable_profiling().

Usage

enable_profiling(mode, metrics, save_location, coverage, format)

Arguments

mode

VARCHAR

metrics

ANY

save_location

VARCHAR

coverage

VARCHAR

format

VARCHAR

Value

Unspecified.

Overloads

  • enable_profiling(mode = VARCHAR, metrics = ANY, save_location = VARCHAR, coverage = VARCHAR, format = VARCHAR)

  • enable_profiling()


DuckDB function enable_progress_bar

Description

DuckDB function enable_progress_bar().

Usage

enable_progress_bar()

Value

Unspecified.


DuckDB function enable_verification

Description

DuckDB function enable_verification().

Usage

enable_verification()

Value

Unspecified.


DuckDB function encode

Description

Converts the string to BLOB. Converts UTF-8 characters into literal encoding.

Usage

encode(string)

Arguments

string

VARCHAR

Value

BLOB

SQL examples

encode('my_string_with_ü')

See Also

Other blob: decode(), from_base64(), hex(), md5(), md5_number(), octet_length(), or–or, repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()


DuckDB function entropy

Description

Returns the log-2 entropy of count input-values.

Usage

entropy(x)

Arguments

x

ANY

Value

DOUBLE


DuckDB function enum_code

Description

Returns the numeric value backing the given enum value.

Usage

enum_code(enum)

Arguments

enum

ANY

Value

ANY

SQL examples

enum_code('happy'::mood)

DuckDB function enum_first

Description

Returns the first value of the input enum type.

Usage

enum_first(enum)

Arguments

enum

ANY

Value

VARCHAR

SQL examples

enum_first(NULL::mood)

DuckDB function enum_last

Description

Returns the last value of the input enum type.

Usage

enum_last(enum)

Arguments

enum

ANY

Value

VARCHAR

SQL examples

enum_last(NULL::mood)

DuckDB function enum_range

Description

Returns all values of the input enum type as an array.

Usage

enum_range(enum)

Arguments

enum

ANY

Value

VARCHAR[]

SQL examples

enum_range(NULL::mood)

DuckDB function enum_range_boundary

Description

Returns the range between the two given enum values as an array. The values must be of the same enum type. When the first parameter is NULL, the result starts with the first value of the enum type. When the second parameter is NULL, the result ends with the last value of the enum type.

Usage

enum_range_boundary(start, end)

Arguments

start, end

ANY

Value

VARCHAR[]

SQL examples

enum_range_boundary(NULL, 'happy'::mood)

DuckDB function epoch

Description

Extract the epoch component from a temporal type.

Usage

epoch(temporal)

Arguments

temporal

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

DOUBLE

SQL examples

epoch(timestamp '2021-08-03 11:59:44.123456')

DuckDB function epoch_ms

Description

Extract the epoch component in milliseconds from a temporal type.

Usage

epoch_ms(temporal)

Arguments

temporal

⁠DATE | TIMESTAMP | INTERVAL | TIME | TIME_NS | TIME WITH TIME ZONE | TIMESTAMP WITH TIME ZONE | BIGINT⁠

Value

BIGINT | TIMESTAMP

SQL examples

epoch_ms(timestamp '2021-08-03 11:59:44.123456')

DuckDB function epoch_ns

Description

Extract the epoch component in nanoseconds from a temporal type.

Usage

epoch_ns(temporal)

Arguments

temporal

⁠DATE | TIMESTAMP | INTERVAL | TIME | TIME_NS | TIME WITH TIME ZONE | TIMESTAMP WITH TIME ZONE | TIMESTAMP_NS⁠

Value

BIGINT

SQL examples

epoch_ns(timestamp '2021-08-03 11:59:44.123456')

DuckDB function epoch_us

Description

Extract the epoch component in microseconds from a temporal type.

Usage

epoch_us(temporal)

Arguments

temporal

⁠DATE | TIMESTAMP | INTERVAL | TIME | TIME_NS | TIME WITH TIME ZONE | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

epoch_us(timestamp '2021-08-03 11:59:44.123456')

DuckDB function equi_width_bins

Description

Generates bin_count equi-width bins between the min and max. If enabled nice_rounding makes the numbers more readable/less jagged.

Usage

equi_width_bins(min, max, bin_count, nice_rounding)

Arguments

min

BIGINT | DOUBLE | TIMESTAMP | ANY

max

BIGINT | DOUBLE | TIMESTAMP | ANY

bin_count

BIGINT

nice_rounding

BOOLEAN

Value

ANY[]

SQL examples

equi_width_bins(0, 10, 2, true)

DuckDB function era

Description

Extract the era component from a date or timestamp.

Usage

era(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

era(timestamp '2021-08-03 11:59:44.123456')

DuckDB function error

Description

Throws the given error message.

Usage

error(message)

Arguments

message

VARCHAR

Value

"NULL"

SQL examples

error('access_mode')

DuckDB function even

Description

Rounds x to next even number by rounding away from zero.

Usage

even(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

even(2.9)

DuckDB function excel_text

Description

DuckDB function excel_text().

Usage

excel_text(col0, col1)

Arguments

col0

DOUBLE

col1

VARCHAR

Value

VARCHAR

Provided by

The excel extension (LOAD excel;).


DuckDB function exp

Description

Computes e to the power of x.

Usage

exp(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

exp(1)

DuckDB function extension_versions

Description

DuckDB function extension_versions().

Usage

extension_versions()

Value

Unspecified.


DuckDB function factorial

Description

Factorial of x. Computes the product of the current integer and all integers below it.

Usage

factorial(x)

Arguments

x

INTEGER

Value

HUGEINT

SQL examples

4!

DuckDB function family

Description

DuckDB function family().

Usage

family(col0)

Arguments

col0

INET

Value

UTINYINT

Provided by

The inet extension (LOAD inet;).


DuckDB function favg

Description

Calculates the average using a more accurate floating point summation (Kahan Sum).

Usage

favg(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

favg(A)

DuckDB function fdiv

Description

DuckDB macro fdiv().

Usage

fdiv(x, y)

Arguments

x, y

Unspecified.

Value

Unspecified.


DuckDB function fill

Description

DuckDB function fill().

Usage

fill(col0)

Arguments

col0

T

Value

T


DuckDB function finalize

Description

DuckDB function finalize().

Usage

finalize(col0)

Arguments

col0

⁠AGGREGATE_STATE<?>⁠

Value

INVALID


DuckDB function first

Description

Returns the first value (NULL or non-NULL) from arg. This function is affected by ordering.

Usage

first(arg)

Arguments

arg

DECIMAL | ANY

Value

DECIMAL | ANY | T

Overloads

  • first(arg = DECIMAL)

  • first(arg = ANY)

  • first(col0 = T)

SQL examples

first(A)

DuckDB function first_value

Description

DuckDB function first_value().

Usage

first_value(col0)

Arguments

col0

T

Value

T


DuckDB function floor

Description

Rounds the number down.

Usage

floor(x)

Arguments

x

FLOAT | DOUBLE | DECIMAL

Value

FLOAT | DOUBLE | DECIMAL

SQL examples

floor(17.4)

DuckDB function fmod

Description

DuckDB macro fmod().

Usage

fmod(x, y)

Arguments

x, y

Unspecified.

Value

Unspecified.


DuckDB function force_checkpoint

Description

DuckDB function force_checkpoint().

Usage

force_checkpoint()

Value

Unspecified.

Overloads

  • force_checkpoint()

  • force_checkpoint(col0 = VARCHAR)


DuckDB function format_pg_type

Description

DuckDB macro format_pg_type().

Usage

format_pg_type(logical_type, type_name)

Arguments

logical_type, type_name

Unspecified.

Value

Unspecified.


DuckDB function format_type

Description

DuckDB macro format_type().

Usage

format_type(type_oid, typemod)

Arguments

type_oid, typemod

Unspecified.

Value

Unspecified.


DuckDB function from_json

Description

DuckDB function from_json().

Usage

from_json(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

ANY

Provided by

The json extension (LOAD json;).


DuckDB function from_json_strict

Description

DuckDB function from_json_strict().

Usage

from_json_strict(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

ANY

Provided by

The json extension (LOAD json;).


DuckDB function functions

Description

DuckDB function functions().

Usage

functions()

Value

Unspecified.


DuckDB function gamma

Description

Interpolation of (x-1) factorial (so decimal inputs are allowed).

Usage

gamma(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

gamma(5.5)

DuckDB function generate_series

Description

Creates a list of values between start and stop - the stop parameter is inclusive.

Usage

generate_series(start, stop, step)

Arguments

start

⁠BIGINT | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

stop

⁠BIGINT | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

step

BIGINT | INTERVAL

Value

⁠BIGINT[] | TIMESTAMP[] | TIMESTAMP WITH TIME ZONE[]⁠

Overloads

  • generate_series(col0 = BIGINT)

  • generate_series(col0 = BIGINT, col1 = BIGINT)

  • generate_series(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT)

  • generate_series(col0 = TIMESTAMP, col1 = TIMESTAMP, col2 = INTERVAL)

  • generate_series(col0 = `TIMESTAMP WITH TIME ZONE`, col1 = `TIMESTAMP WITH TIME ZONE`, col2 = INTERVAL)

  • generate_series(start = BIGINT)

  • generate_series(start = BIGINT, stop = BIGINT)

  • generate_series(start = BIGINT, stop = BIGINT, step = BIGINT)

  • generate_series(start = TIMESTAMP, stop = TIMESTAMP, step = INTERVAL)

  • generate_series(start = `TIMESTAMP WITH TIME ZONE`, stop = `TIMESTAMP WITH TIME ZONE`, step = INTERVAL)

Provided by

  • generate_series(col0 = BIGINT): built in

  • generate_series(col0 = BIGINT, col1 = BIGINT): built in

  • generate_series(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT): built in

  • generate_series(col0 = TIMESTAMP, col1 = TIMESTAMP, col2 = INTERVAL): built in

  • generate_series(col0 = `TIMESTAMP WITH TIME ZONE`, col1 = `TIMESTAMP WITH TIME ZONE`, col2 = INTERVAL): icu

  • generate_series(start = BIGINT): built in

  • generate_series(start = BIGINT, stop = BIGINT): built in

  • generate_series(start = BIGINT, stop = BIGINT, step = BIGINT): built in

  • generate_series(start = TIMESTAMP, stop = TIMESTAMP, step = INTERVAL): built in

  • generate_series(start = `TIMESTAMP WITH TIME ZONE`, stop = `TIMESTAMP WITH TIME ZONE`, step = INTERVAL): built in

SQL examples

generate_series(2, 5, 3)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function generate_subscripts

Description

DuckDB macro generate_subscripts().

Usage

generate_subscripts(arr, dim)

Arguments

arr, dim

Unspecified.

Value

Unspecified.


DuckDB function geomean

Description

DuckDB macro geomean().

Usage

geomean(x)

Arguments

x

Unspecified.

Value

Unspecified.


DuckDB function geometric_mean

Description

DuckDB macro geometric_mean().

Usage

geometric_mean(x)

Arguments

x

Unspecified.

Value

Unspecified.


DuckDB function get_bit

Description

Extracts the nth bit from bitstring; the first (leftmost) bit is indexed 0.

Usage

get_bit(bitstring, index)

Arguments

bitstring

BIT

index

INTEGER

Value

INTEGER

SQL examples

get_bit('0110010'::BIT, 2)

DuckDB function get_block_size

Description

DuckDB macro get_block_size().

Usage

get_block_size(db_name)

Arguments

db_name

Unspecified.

Value

Unspecified.


DuckDB function get_current_time

Description

DuckDB function get_current_time().

Usage

get_current_time()

Value

⁠TIME WITH TIME ZONE⁠

Provided by

The icu extension (LOAD icu;).


DuckDB function get_current_timestamp

Description

Returns the current timestamp.

Usage

get_current_timestamp()

Value

⁠TIMESTAMP WITH TIME ZONE⁠

SQL examples

get_current_timestamp()

DuckDB function get_delta_test_expression

Description

DuckDB function get_delta_test_expression().

Usage

get_delta_test_expression()

Value

VARCHAR[]

Provided by

The delta extension (LOAD delta;).


DuckDB function get_type

Description

Returns the type of the result of the expression.

Usage

get_type(expression)

Arguments

expression

ANY

Value

TYPE

SQL examples

get_type('abc')

DuckDB function get_ui_url

Description

DuckDB function get_ui_url().

Usage

get_ui_url()

Value

Unspecified.

Provided by

The ui extension (LOAD ui;).


DuckDB function getvariable

Description

DuckDB function getvariable().

Usage

getvariable(col0)

Arguments

col0

VARCHAR

Value

ANY


DuckDB function glob

Description

DuckDB function glob().

Usage

glob(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function greatest

Description

Returns the largest value. For strings lexicographical ordering is used. Note that lowercase characters are considered “larger” than uppercase characters and collations are not supported.

Usage

greatest(arg1)

Arguments

arg1

ANY

Value

ANY

SQL examples

greatest(42, 84)
greatest('abc', 'bcd', 'cde', 'EFG')

See Also

Other aggregate: least()

Other date: least()

Other numeric: bin(), bit_length(), formatReadableDecimalSize(), format_bytes(), hex(), least(), len(), parse_formatted_bytes(), to_base()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()

Other timestamp: least()


DuckDB function greatest_common_divisor

Description

Computes the greatest common divisor of x and y.

Usage

greatest_common_divisor(x, y)

Arguments

x, y

BIGINT | HUGEINT

Value

BIGINT | HUGEINT

SQL examples

greatest_common_divisor(42, 57)

DuckDB function hamming

Description

The Hamming distance between to strings, i.e., the number of positions with different characters for two strings of equal length. Strings must be of equal length. Characters of different cases (e.g., a and A) are considered different.

Usage

hamming(s1, s2)

Arguments

s1, s2

VARCHAR

Value

BIGINT

SQL examples

hamming('duck', 'luck')

See Also

Other text_similarity: damerau_levenshtein(), jaccard(), jaro_similarity(), jaro_winkler_similarity(), levenshtein()


DuckDB function has_any_column_privilege

Description

DuckDB function has_any_column_privilege().

Usage

has_any_column_privilege(user, table, privilege)

Arguments

user, table, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_any_column_privilege(table, privilege)

  • has_any_column_privilege(user, table, privilege)


DuckDB function has_column_privilege

Description

DuckDB function has_column_privilege().

Usage

has_column_privilege(user, table, column, privilege)

Arguments

user, table, column, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_column_privilege(table, column, privilege)

  • has_column_privilege(user, table, column, privilege)


DuckDB function has_database_privilege

Description

DuckDB function has_database_privilege().

Usage

has_database_privilege(user, database, privilege)

Arguments

user, database, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_database_privilege(database, privilege)

  • has_database_privilege(user, database, privilege)


DuckDB function has_foreign_data_wrapper_privilege

Description

DuckDB function has_foreign_data_wrapper_privilege().

Usage

has_foreign_data_wrapper_privilege(user, fdw, privilege)

Arguments

user, fdw, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_foreign_data_wrapper_privilege(fdw, privilege)

  • has_foreign_data_wrapper_privilege(user, fdw, privilege)


DuckDB function has_function_privilege

Description

DuckDB function has_function_privilege().

Usage

has_function_privilege(user, function., privilege)

Arguments

user, function., privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_function_privilege(function., privilege)

  • has_function_privilege(user, function., privilege)


DuckDB function has_language_privilege

Description

DuckDB function has_language_privilege().

Usage

has_language_privilege(user, language, privilege)

Arguments

user, language, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_language_privilege(language, privilege)

  • has_language_privilege(user, language, privilege)


DuckDB function has_schema_privilege

Description

DuckDB function has_schema_privilege().

Usage

has_schema_privilege(user, schema, privilege)

Arguments

user, schema, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_schema_privilege(schema, privilege)

  • has_schema_privilege(user, schema, privilege)


DuckDB function has_sequence_privilege

Description

DuckDB function has_sequence_privilege().

Usage

has_sequence_privilege(user, sequence, privilege)

Arguments

user, sequence, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_sequence_privilege(sequence, privilege)

  • has_sequence_privilege(user, sequence, privilege)


DuckDB function has_server_privilege

Description

DuckDB function has_server_privilege().

Usage

has_server_privilege(user, server, privilege)

Arguments

user, server, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_server_privilege(server, privilege)

  • has_server_privilege(user, server, privilege)


DuckDB function has_table_privilege

Description

DuckDB function has_table_privilege().

Usage

has_table_privilege(user, table, privilege)

Arguments

user, table, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_table_privilege(table, privilege)

  • has_table_privilege(user, table, privilege)


DuckDB function has_tablespace_privilege

Description

DuckDB function has_tablespace_privilege().

Usage

has_tablespace_privilege(user, tablespace, privilege)

Arguments

user, tablespace, privilege

Unspecified.

Value

Unspecified.

Overloads

  • has_tablespace_privilege(tablespace, privilege)

  • has_tablespace_privilege(user, tablespace, privilege)


DuckDB function hex

Description

  • hex(string = VARCHAR): Converts the string to hexadecimal representation.

  • hex(value = BIGNUM), hex(value = BIGINT), hex(value = UBIGINT), hex(value = HUGEINT), hex(value = UHUGEINT): Converts the value to VARCHAR using hexadecimal representation.

  • hex(blob = BLOB): Converts blob to VARCHAR using hexadecimal encoding.

Usage

hex(value)

Arguments

value

BIGNUM | BIGINT | UBIGINT | HUGEINT | UHUGEINT

Value

VARCHAR

Overloads

  • hex(string = VARCHAR)

  • hex(value = BIGNUM)

  • hex(blob = BLOB)

  • hex(value = BIGINT)

  • hex(value = UBIGINT)

  • hex(value = HUGEINT)

  • hex(value = UHUGEINT)

SQL examples

hex('Hello')
hex(42)
hex('\xAA\xBB'::BLOB)

See Also

Other blob: decode(), encode(), from_base64(), md5(), md5_number(), octet_length(), or–or, repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()

Other numeric: bin(), bit_length(), formatReadableDecimalSize(), format_bytes(), greatest(), least(), len(), parse_formatted_bytes(), to_base()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function histogram

Description

Returns a LIST of STRUCTs with the fields bucket and count.

Usage

histogram(source, col_name, bin_count, technique)

Arguments

source, col_name, bin_count, technique

Unspecified.

Value

MAP

Overloads

  • histogram(arg = ANY, col1 = `ANY[]`)

  • histogram(arg = ANY)

  • histogram(source, col_name, bin_count, technique)

SQL examples

histogram(A)

DuckDB function histogram_exact

Description

Returns a LIST of STRUCTs with the fields bucket and count matching the buckets exactly.

Usage

histogram_exact(arg, bins)

Arguments

arg

ANY

bins

ANY[]

Value

MAP

SQL examples

histogram_exact(A, [0, 1, 2])

DuckDB function histogram_values

Description

DuckDB macro histogram_values().

Usage

histogram_values(source, col_name, bin_count, technique)

Arguments

source, col_name, bin_count, technique

Unspecified.

Value

Unspecified.


DuckDB function hnsw_compact_index

Description

DuckDB function hnsw_compact_index().

Usage

hnsw_compact_index(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The vss extension (LOAD vss;).


DuckDB function hnsw_index_scan

Description

DuckDB function hnsw_index_scan().

Usage

hnsw_index_scan()

Value

Unspecified.

Provided by

The vss extension (LOAD vss;).


DuckDB function host

Description

DuckDB function host().

Usage

host(col0)

Arguments

col0

INET

Value

VARCHAR

Provided by

The inet extension (LOAD inet;).


DuckDB function hour

Description

Extract the hour component from a date or timestamp.

Usage

hour(ts)

Arguments

ts

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

hour(timestamp '2021-08-03 11:59:44.123456')

DuckDB function html_escape

Description

DuckDB function html_escape().

Usage

html_escape(col0, col1)

Arguments

col0

VARCHAR

col1

BOOLEAN

Value

VARCHAR

Overloads

  • html_escape(col0 = VARCHAR)

  • html_escape(col0 = VARCHAR, col1 = BOOLEAN)

Provided by

The inet extension (LOAD inet;).


DuckDB function html_unescape

Description

DuckDB function html_unescape().

Usage

html_unescape(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The inet extension (LOAD inet;).


DuckDB function iceberg_bucket

Description

DuckDB function iceberg_bucket().

Usage

iceberg_bucket(col0, col1)

Arguments

col0

INTEGER

col1

⁠INTEGER | BIGINT | VARCHAR | BLOB | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE | TIMESTAMP_NS | TIME | UUID | DECIMAL⁠

Value

INTEGER

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_column_stats

Description

DuckDB function iceberg_column_stats().

Usage

iceberg_column_stats(
  col0,
  snapshot_from_timestamp,
  snapshot_from_id,
  version_name_format,
  version,
  metadata_compression_codec,
  allow_moved_paths
)

Arguments

col0

VARCHAR

snapshot_from_timestamp

TIMESTAMP

snapshot_from_id

UBIGINT

version_name_format

VARCHAR

version

VARCHAR

metadata_compression_codec

VARCHAR

allow_moved_paths

BOOLEAN

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_load_table_response

Description

DuckDB function iceberg_load_table_response().

Usage

iceberg_load_table_response(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_metadata

Description

DuckDB function iceberg_metadata().

Usage

iceberg_metadata(
  col0,
  snapshot_from_timestamp,
  snapshot_from_id,
  version_name_format,
  version,
  metadata_compression_codec,
  allow_moved_paths
)

Arguments

col0

VARCHAR

snapshot_from_timestamp

TIMESTAMP

snapshot_from_id

UBIGINT

version_name_format

VARCHAR

version

VARCHAR

metadata_compression_codec

VARCHAR

allow_moved_paths

BOOLEAN

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_partition_stats

Description

DuckDB function iceberg_partition_stats().

Usage

iceberg_partition_stats(
  col0,
  snapshot_from_timestamp,
  snapshot_from_id,
  version_name_format,
  version,
  metadata_compression_codec,
  allow_moved_paths
)

Arguments

col0

VARCHAR

snapshot_from_timestamp

TIMESTAMP

snapshot_from_id

UBIGINT

version_name_format

VARCHAR

version

VARCHAR

metadata_compression_codec

VARCHAR

allow_moved_paths

BOOLEAN

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_scan

Description

DuckDB function iceberg_scan().

Usage

iceberg_scan(
  col0,
  snapshot_from_timestamp,
  version,
  metadata_compression_codec,
  mode,
  can_have_nan,
  allow_moved_paths,
  filename,
  union_by_name,
  snapshot_from_id,
  debug_use_openssl,
  hive_partitioning,
  parquet_version,
  encryption_config,
  version_name_format,
  hive_types_autocast,
  binary_as_string,
  explicit_cardinality,
  compression,
  file_row_number,
  hive_types
)

Arguments

col0

VARCHAR | VARCHAR[]

snapshot_from_timestamp

TIMESTAMP

version

VARCHAR

metadata_compression_codec

VARCHAR

mode

VARCHAR

can_have_nan

BOOLEAN

allow_moved_paths

BOOLEAN

filename

ANY

union_by_name

BOOLEAN

snapshot_from_id

UBIGINT

debug_use_openssl

BOOLEAN

hive_partitioning

BOOLEAN

parquet_version

VARCHAR

encryption_config

ANY

version_name_format

VARCHAR

hive_types_autocast

BOOLEAN

binary_as_string

BOOLEAN

explicit_cardinality

UBIGINT

compression

VARCHAR

file_row_number

BOOLEAN

hive_types

ANY

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_schema_properties

Description

DuckDB function iceberg_schema_properties().

Usage

iceberg_schema_properties(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_snapshots

Description

DuckDB function iceberg_snapshots().

Usage

iceberg_snapshots(col0, version_name_format, version, metadata_compression_codec)

Arguments

col0, version_name_format, version, metadata_compression_codec

VARCHAR

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_table_properties

Description

DuckDB function iceberg_table_properties().

Usage

iceberg_table_properties(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_to_ducklake

Description

DuckDB function iceberg_to_ducklake().

Usage

iceberg_to_ducklake(col0, col1, skip_tables)

Arguments

col0

VARCHAR

col1

VARCHAR

skip_tables

VARCHAR[]

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_truncate

Description

DuckDB function iceberg_truncate().

Usage

iceberg_truncate(col0, col1)

Arguments

col0

INTEGER

col1

INTEGER | BIGINT | VARCHAR | BLOB | DECIMAL

Value

INTEGER | BIGINT | VARCHAR | BLOB | DECIMAL

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function iceberg_verify_equality_deletes

Description

DuckDB function iceberg_verify_equality_deletes().

Usage

iceberg_verify_equality_deletes()

Value

BOOLEAN

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function icu_calendar_names

Description

DuckDB function icu_calendar_names().

Usage

icu_calendar_names()

Value

Unspecified.

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_af

Description

DuckDB function icu_collate_af().

Usage

icu_collate_af(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_am

Description

DuckDB function icu_collate_am().

Usage

icu_collate_am(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ar

Description

DuckDB function icu_collate_ar().

Usage

icu_collate_ar(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ar_sa

Description

DuckDB function icu_collate_ar_sa().

Usage

icu_collate_ar_sa(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_as

Description

DuckDB function icu_collate_as().

Usage

icu_collate_as(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_az

Description

DuckDB function icu_collate_az().

Usage

icu_collate_az(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_be

Description

DuckDB function icu_collate_be().

Usage

icu_collate_be(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_bg

Description

DuckDB function icu_collate_bg().

Usage

icu_collate_bg(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_bn

Description

DuckDB function icu_collate_bn().

Usage

icu_collate_bn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_bo

Description

DuckDB function icu_collate_bo().

Usage

icu_collate_bo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_br

Description

DuckDB function icu_collate_br().

Usage

icu_collate_br(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_bs

Description

DuckDB function icu_collate_bs().

Usage

icu_collate_bs(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ca

Description

DuckDB function icu_collate_ca().

Usage

icu_collate_ca(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ceb

Description

DuckDB function icu_collate_ceb().

Usage

icu_collate_ceb(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_chr

Description

DuckDB function icu_collate_chr().

Usage

icu_collate_chr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_cs

Description

DuckDB function icu_collate_cs().

Usage

icu_collate_cs(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_cy

Description

DuckDB function icu_collate_cy().

Usage

icu_collate_cy(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_da

Description

DuckDB function icu_collate_da().

Usage

icu_collate_da(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_de

Description

DuckDB function icu_collate_de().

Usage

icu_collate_de(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_de_at

Description

DuckDB function icu_collate_de_at().

Usage

icu_collate_de_at(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_dsb

Description

DuckDB function icu_collate_dsb().

Usage

icu_collate_dsb(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_dz

Description

DuckDB function icu_collate_dz().

Usage

icu_collate_dz(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ee

Description

DuckDB function icu_collate_ee().

Usage

icu_collate_ee(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_el

Description

DuckDB function icu_collate_el().

Usage

icu_collate_el(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_en

Description

DuckDB function icu_collate_en().

Usage

icu_collate_en(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_en_us

Description

DuckDB function icu_collate_en_us().

Usage

icu_collate_en_us(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_eo

Description

DuckDB function icu_collate_eo().

Usage

icu_collate_eo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_es

Description

DuckDB function icu_collate_es().

Usage

icu_collate_es(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_et

Description

DuckDB function icu_collate_et().

Usage

icu_collate_et(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fa

Description

DuckDB function icu_collate_fa().

Usage

icu_collate_fa(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fa_af

Description

DuckDB function icu_collate_fa_af().

Usage

icu_collate_fa_af(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ff

Description

DuckDB function icu_collate_ff().

Usage

icu_collate_ff(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fi

Description

DuckDB function icu_collate_fi().

Usage

icu_collate_fi(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fil

Description

DuckDB function icu_collate_fil().

Usage

icu_collate_fil(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fo

Description

DuckDB function icu_collate_fo().

Usage

icu_collate_fo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fr

Description

DuckDB function icu_collate_fr().

Usage

icu_collate_fr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fr_ca

Description

DuckDB function icu_collate_fr_ca().

Usage

icu_collate_fr_ca(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_fy

Description

DuckDB function icu_collate_fy().

Usage

icu_collate_fy(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ga

Description

DuckDB function icu_collate_ga().

Usage

icu_collate_ga(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_gl

Description

DuckDB function icu_collate_gl().

Usage

icu_collate_gl(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_gu

Description

DuckDB function icu_collate_gu().

Usage

icu_collate_gu(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ha

Description

DuckDB function icu_collate_ha().

Usage

icu_collate_ha(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_haw

Description

DuckDB function icu_collate_haw().

Usage

icu_collate_haw(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_he

Description

DuckDB function icu_collate_he().

Usage

icu_collate_he(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_he_il

Description

DuckDB function icu_collate_he_il().

Usage

icu_collate_he_il(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_hi

Description

DuckDB function icu_collate_hi().

Usage

icu_collate_hi(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_hr

Description

DuckDB function icu_collate_hr().

Usage

icu_collate_hr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_hsb

Description

DuckDB function icu_collate_hsb().

Usage

icu_collate_hsb(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_hu

Description

DuckDB function icu_collate_hu().

Usage

icu_collate_hu(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_hy

Description

DuckDB function icu_collate_hy().

Usage

icu_collate_hy(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_id

Description

DuckDB function icu_collate_id().

Usage

icu_collate_id(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_id_id

Description

DuckDB function icu_collate_id_id().

Usage

icu_collate_id_id(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ig

Description

DuckDB function icu_collate_ig().

Usage

icu_collate_ig(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_is

Description

DuckDB function icu_collate_is().

Usage

icu_collate_is(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_it

Description

DuckDB function icu_collate_it().

Usage

icu_collate_it(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ja

Description

DuckDB function icu_collate_ja().

Usage

icu_collate_ja(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ka

Description

DuckDB function icu_collate_ka().

Usage

icu_collate_ka(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_kk

Description

DuckDB function icu_collate_kk().

Usage

icu_collate_kk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_kl

Description

DuckDB function icu_collate_kl().

Usage

icu_collate_kl(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_km

Description

DuckDB function icu_collate_km().

Usage

icu_collate_km(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_kn

Description

DuckDB function icu_collate_kn().

Usage

icu_collate_kn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ko

Description

DuckDB function icu_collate_ko().

Usage

icu_collate_ko(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_kok

Description

DuckDB function icu_collate_kok().

Usage

icu_collate_kok(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ku

Description

DuckDB function icu_collate_ku().

Usage

icu_collate_ku(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ky

Description

DuckDB function icu_collate_ky().

Usage

icu_collate_ky(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lb

Description

DuckDB function icu_collate_lb().

Usage

icu_collate_lb(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lij

Description

DuckDB function icu_collate_lij().

Usage

icu_collate_lij(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lkt

Description

DuckDB function icu_collate_lkt().

Usage

icu_collate_lkt(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ln

Description

DuckDB function icu_collate_ln().

Usage

icu_collate_ln(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lo

Description

DuckDB function icu_collate_lo().

Usage

icu_collate_lo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lt

Description

DuckDB function icu_collate_lt().

Usage

icu_collate_lt(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_lv

Description

DuckDB function icu_collate_lv().

Usage

icu_collate_lv(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_mk

Description

DuckDB function icu_collate_mk().

Usage

icu_collate_mk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ml

Description

DuckDB function icu_collate_ml().

Usage

icu_collate_ml(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_mn

Description

DuckDB function icu_collate_mn().

Usage

icu_collate_mn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_mr

Description

DuckDB function icu_collate_mr().

Usage

icu_collate_mr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ms

Description

DuckDB function icu_collate_ms().

Usage

icu_collate_ms(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_mt

Description

DuckDB function icu_collate_mt().

Usage

icu_collate_mt(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_my

Description

DuckDB function icu_collate_my().

Usage

icu_collate_my(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_nb

Description

DuckDB function icu_collate_nb().

Usage

icu_collate_nb(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_nb_no

Description

DuckDB function icu_collate_nb_no().

Usage

icu_collate_nb_no(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ne

Description

DuckDB function icu_collate_ne().

Usage

icu_collate_ne(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_nl

Description

DuckDB function icu_collate_nl().

Usage

icu_collate_nl(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_nn

Description

DuckDB function icu_collate_nn().

Usage

icu_collate_nn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_noaccent

Description

DuckDB function icu_collate_noaccent().

Usage

icu_collate_noaccent(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_nso

Description

DuckDB function icu_collate_nso().

Usage

icu_collate_nso(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_om

Description

DuckDB function icu_collate_om().

Usage

icu_collate_om(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_or

Description

DuckDB function icu_collate_or().

Usage

icu_collate_or(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_pa

Description

DuckDB function icu_collate_pa().

Usage

icu_collate_pa(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_pa_in

Description

DuckDB function icu_collate_pa_in().

Usage

icu_collate_pa_in(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_pl

Description

DuckDB function icu_collate_pl().

Usage

icu_collate_pl(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ps

Description

DuckDB function icu_collate_ps().

Usage

icu_collate_ps(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_pt

Description

DuckDB function icu_collate_pt().

Usage

icu_collate_pt(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ro

Description

DuckDB function icu_collate_ro().

Usage

icu_collate_ro(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ru

Description

DuckDB function icu_collate_ru().

Usage

icu_collate_ru(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sa

Description

DuckDB function icu_collate_sa().

Usage

icu_collate_sa(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_se

Description

DuckDB function icu_collate_se().

Usage

icu_collate_se(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_si

Description

DuckDB function icu_collate_si().

Usage

icu_collate_si(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sk

Description

DuckDB function icu_collate_sk().

Usage

icu_collate_sk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sl

Description

DuckDB function icu_collate_sl().

Usage

icu_collate_sl(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_smn

Description

DuckDB function icu_collate_smn().

Usage

icu_collate_smn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sq

Description

DuckDB function icu_collate_sq().

Usage

icu_collate_sq(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sr

Description

DuckDB function icu_collate_sr().

Usage

icu_collate_sr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sr_ba

Description

DuckDB function icu_collate_sr_ba().

Usage

icu_collate_sr_ba(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sr_me

Description

DuckDB function icu_collate_sr_me().

Usage

icu_collate_sr_me(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sr_rs

Description

DuckDB function icu_collate_sr_rs().

Usage

icu_collate_sr_rs(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_st

Description

DuckDB function icu_collate_st().

Usage

icu_collate_st(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sv

Description

DuckDB function icu_collate_sv().

Usage

icu_collate_sv(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_sw

Description

DuckDB function icu_collate_sw().

Usage

icu_collate_sw(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ta

Description

DuckDB function icu_collate_ta().

Usage

icu_collate_ta(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_te

Description

DuckDB function icu_collate_te().

Usage

icu_collate_te(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_th

Description

DuckDB function icu_collate_th().

Usage

icu_collate_th(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_tk

Description

DuckDB function icu_collate_tk().

Usage

icu_collate_tk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_tn

Description

DuckDB function icu_collate_tn().

Usage

icu_collate_tn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_to

Description

DuckDB function icu_collate_to().

Usage

icu_collate_to(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_tr

Description

DuckDB function icu_collate_tr().

Usage

icu_collate_tr(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ug

Description

DuckDB function icu_collate_ug().

Usage

icu_collate_ug(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_uk

Description

DuckDB function icu_collate_uk().

Usage

icu_collate_uk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_ur

Description

DuckDB function icu_collate_ur().

Usage

icu_collate_ur(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_uz

Description

DuckDB function icu_collate_uz().

Usage

icu_collate_uz(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_vi

Description

DuckDB function icu_collate_vi().

Usage

icu_collate_vi(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_wae

Description

DuckDB function icu_collate_wae().

Usage

icu_collate_wae(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_wo

Description

DuckDB function icu_collate_wo().

Usage

icu_collate_wo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_xh

Description

DuckDB function icu_collate_xh().

Usage

icu_collate_xh(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_yi

Description

DuckDB function icu_collate_yi().

Usage

icu_collate_yi(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_yo

Description

DuckDB function icu_collate_yo().

Usage

icu_collate_yo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_yue

Description

DuckDB function icu_collate_yue().

Usage

icu_collate_yue(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_yue_cn

Description

DuckDB function icu_collate_yue_cn().

Usage

icu_collate_yue_cn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh

Description

DuckDB function icu_collate_zh().

Usage

icu_collate_zh(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh_cn

Description

DuckDB function icu_collate_zh_cn().

Usage

icu_collate_zh_cn(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh_hk

Description

DuckDB function icu_collate_zh_hk().

Usage

icu_collate_zh_hk(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh_mo

Description

DuckDB function icu_collate_zh_mo().

Usage

icu_collate_zh_mo(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh_sg

Description

DuckDB function icu_collate_zh_sg().

Usage

icu_collate_zh_sg(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zh_tw

Description

DuckDB function icu_collate_zh_tw().

Usage

icu_collate_zh_tw(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_collate_zu

Description

DuckDB function icu_collate_zu().

Usage

icu_collate_zu(col0)

Arguments

col0

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function icu_sort_key

Description

DuckDB function icu_sort_key().

Usage

icu_sort_key(col0, col1)

Arguments

col0, col1

VARCHAR

Value

VARCHAR

Provided by

The icu extension (LOAD icu;).


DuckDB function ilike_escape

Description

Returns true if the string matches the like_specifier (see Pattern Matching) using case-insensitive matching. escape_character is used to search for wildcard characters in the string.

Usage

ilike_escape(string, like_specifier, escape_character)

Arguments

string, like_specifier, escape_character

VARCHAR

Value

BOOLEAN

SQL examples

ilike_escape('A%c', 'a$%C', '$')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function import_database

Description

DuckDB function import_database().

Usage

import_database(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function in_search_path

Description

Returns whether or not the database/schema are in the search path.

Usage

in_search_path(database_name, schema_name)

Arguments

database_name, schema_name

VARCHAR

Value

BOOLEAN

SQL examples

in_search_path('memory', 'main')

DuckDB function inet_client_addr

Description

DuckDB macro inet_client_addr().

Usage

inet_client_addr()

Value

Unspecified.


DuckDB function inet_client_port

Description

DuckDB macro inet_client_port().

Usage

inet_client_port()

Value

Unspecified.


DuckDB function inet_server_addr

Description

DuckDB macro inet_server_addr().

Usage

inet_server_addr()

Value

Unspecified.


DuckDB function inet_server_port

Description

DuckDB macro inet_server_port().

Usage

inet_server_port()

Value

Unspecified.


DuckDB function is_histogram_other_bin

Description

Whether or not the provided value is the histogram "other" bin (used for values not belonging to any provided bin).

Usage

is_histogram_other_bin(val)

Arguments

val

ANY

Value

BOOLEAN

SQL examples

is_histogram_other_bin(v)

DuckDB function isfinite

Description

Returns true if the floating point value is finite, false otherwise.

Usage

isfinite(x)

Arguments

x

⁠FLOAT | DOUBLE | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BOOLEAN

SQL examples

isfinite(5.5)

DuckDB function isinf

Description

Returns true if the floating point value is infinite, false otherwise.

Usage

isinf(x)

Arguments

x

⁠FLOAT | DOUBLE | DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BOOLEAN

SQL examples

isinf('Infinity'::float)

DuckDB function isnan

Description

Returns true if the floating point value is not a number, false otherwise.

Usage

isnan(x)

Arguments

x

FLOAT | DOUBLE

Value

BOOLEAN

SQL examples

isnan('NaN'::FLOAT)

DuckDB function isodow

Description

Extract the isodow component from a date or timestamp.

Usage

isodow(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

isodow(timestamp '2021-08-03 11:59:44.123456')

DuckDB function isoyear

Description

Extract the isoyear component from a date or timestamp.

Usage

isoyear(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

isoyear(timestamp '2021-08-03 11:59:44.123456')

DuckDB function jaccard

Description

The Jaccard similarity between two strings. Characters of different cases (e.g., a and A) are considered different. Returns a number between 0 and 1.

Usage

jaccard(s1, s2)

Arguments

s1, s2

VARCHAR

Value

DOUBLE

SQL examples

jaccard('duck', 'luck')

See Also

Other text_similarity: damerau_levenshtein(), hamming(), jaro_similarity(), jaro_winkler_similarity(), levenshtein()


DuckDB function jaro_similarity

Description

The Jaro similarity between two strings. Characters of different cases (e.g., a and A) are considered different. Returns a number between 0 and 1. For similarity < score_cutoff, 0 is returned instead. score_cutoff defaults to 0.

Usage

jaro_similarity(s1, s2, score_cutoff)

Arguments

s1

VARCHAR

s2

VARCHAR

score_cutoff

DOUBLE

Value

DOUBLE

Overloads

  • jaro_similarity(s1 = VARCHAR, s2 = VARCHAR)

  • jaro_similarity(s1 = VARCHAR, s2 = VARCHAR, score_cutoff = DOUBLE)

SQL examples

jaro_similarity('duck', 'duckdb')

See Also

Other text_similarity: damerau_levenshtein(), hamming(), jaccard(), jaro_winkler_similarity(), levenshtein()


DuckDB function jaro_winkler_similarity

Description

The Jaro-Winkler similarity between two strings. Characters of different cases (e.g., a and A) are considered different. Returns a number between 0 and 1. For similarity < score_cutoff, 0 is returned instead. score_cutoff defaults to 0.

Usage

jaro_winkler_similarity(s1, s2, score_cutoff)

Arguments

s1

VARCHAR

s2

VARCHAR

score_cutoff

DOUBLE

Value

DOUBLE

Overloads

  • jaro_winkler_similarity(s1 = VARCHAR, s2 = VARCHAR)

  • jaro_winkler_similarity(s1 = VARCHAR, s2 = VARCHAR, score_cutoff = DOUBLE)

SQL examples

jaro_winkler_similarity('duck', 'duckdb')

See Also

Other text_similarity: damerau_levenshtein(), hamming(), jaccard(), jaro_similarity(), levenshtein()


DuckDB function json

Description

DuckDB macro json().

Usage

json(x)

Arguments

x

Unspecified.

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function json_array

Description

DuckDB function json_array().

Usage

json_array()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function json_array_length

Description

DuckDB function json_array_length().

Usage

json_array_length(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR | VARCHAR[]

Value

UBIGINT | UBIGINT[]

Overloads

  • json_array_length(col0 = VARCHAR)

  • json_array_length(col0 = VARCHAR, col1 = VARCHAR)

  • json_array_length(col0 = VARCHAR, col1 = `VARCHAR[]`)

  • json_array_length(col0 = JSON)

  • json_array_length(col0 = JSON, col1 = VARCHAR)

  • json_array_length(col0 = JSON, col1 = `VARCHAR[]`)

Provided by

The json extension (LOAD json;).


DuckDB function json_contains

Description

DuckDB function json_contains().

Usage

json_contains(col0, col1)

Arguments

col0, col1

VARCHAR | JSON

Value

BOOLEAN

Provided by

The json extension (LOAD json;).


DuckDB function json_deserialize_sql

Description

DuckDB function json_deserialize_sql().

Usage

json_deserialize_sql(col0)

Arguments

col0

JSON

Value

VARCHAR

Provided by

The json extension (LOAD json;).


DuckDB function json_each

Description

DuckDB function json_each().

Usage

json_each(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

Unspecified.

Overloads

  • json_each(col0 = VARCHAR)

  • json_each(col0 = VARCHAR, col1 = VARCHAR)

  • json_each(col0 = JSON)

  • json_each(col0 = JSON, col1 = VARCHAR)

Provided by

The json extension (LOAD json;).


DuckDB function json_execute_serialized_sql

Description

DuckDB function json_execute_serialized_sql().

Usage

json_execute_serialized_sql(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function json_exists

Description

DuckDB function json_exists().

Usage

json_exists(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR | VARCHAR[]

Value

BOOLEAN | BOOLEAN[]

Provided by

The json extension (LOAD json;).


DuckDB function json_extract

Description

DuckDB function json_extract().

Usage

json_extract(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

JSON | JSON[]

Provided by

The json extension (LOAD json;).


DuckDB function json_extract_path

Description

DuckDB function json_extract_path().

Usage

json_extract_path(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

JSON | JSON[]

Provided by

The json extension (LOAD json;).


DuckDB function json_extract_path_text

Description

DuckDB function json_extract_path_text().

Usage

json_extract_path_text(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

VARCHAR | VARCHAR[]

Provided by

The json extension (LOAD json;).


DuckDB function json_extract_string

Description

DuckDB function json_extract_string().

Usage

json_extract_string(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

VARCHAR | VARCHAR[]

Provided by

The json extension (LOAD json;).


DuckDB function json_group_array

Description

DuckDB macro json_group_array().

Usage

json_group_array(x)

Arguments

x

Unspecified.

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function json_group_object

Description

DuckDB macro json_group_object().

Usage

json_group_object(n, v)

Arguments

n, v

Unspecified.

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function json_group_structure

Description

DuckDB macro json_group_structure().

Usage

json_group_structure(x)

Arguments

x

Unspecified.

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function json_keys

Description

DuckDB function json_keys().

Usage

json_keys(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR | VARCHAR[]

Value

VARCHAR[] | VARCHAR[][]

Overloads

  • json_keys(col0 = VARCHAR)

  • json_keys(col0 = VARCHAR, col1 = VARCHAR)

  • json_keys(col0 = VARCHAR, col1 = `VARCHAR[]`)

  • json_keys(col0 = JSON)

  • json_keys(col0 = JSON, col1 = VARCHAR)

  • json_keys(col0 = JSON, col1 = `VARCHAR[]`)

Provided by

The json extension (LOAD json;).


DuckDB function json_merge_patch

Description

DuckDB function json_merge_patch().

Usage

json_merge_patch(col0, col1)

Arguments

col0, col1

JSON

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function json_object

Description

DuckDB function json_object().

Usage

json_object()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function json_pretty

Description

DuckDB function json_pretty().

Usage

json_pretty(col0)

Arguments

col0

JSON

Value

VARCHAR

Provided by

The json extension (LOAD json;).


DuckDB function json_quote

Description

DuckDB function json_quote().

Usage

json_quote()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function json_serialize_plan

Description

DuckDB function json_serialize_plan().

Usage

json_serialize_plan(col0, col1, col2, col3, col4)

Arguments

col0

VARCHAR

col1

BOOLEAN

col2

BOOLEAN

col3

BOOLEAN

col4

BOOLEAN

Value

JSON

Overloads

  • json_serialize_plan(col0 = VARCHAR)

  • json_serialize_plan(col0 = VARCHAR, col1 = BOOLEAN)

  • json_serialize_plan(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN)

  • json_serialize_plan(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN, col3 = BOOLEAN)

  • json_serialize_plan(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN, col3 = BOOLEAN, col4 = BOOLEAN)

Provided by

The json extension (LOAD json;).


DuckDB function json_serialize_sql

Description

DuckDB function json_serialize_sql().

Usage

json_serialize_sql(col0, col1, col2, col3, col4)

Arguments

col0

VARCHAR

col1

BOOLEAN

col2

BOOLEAN

col3

BOOLEAN

col4

BOOLEAN

Value

JSON

Overloads

  • json_serialize_sql(col0 = VARCHAR)

  • json_serialize_sql(col0 = VARCHAR, col1 = BOOLEAN)

  • json_serialize_sql(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN)

  • json_serialize_sql(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN, col3 = BOOLEAN)

  • json_serialize_sql(col0 = VARCHAR, col1 = BOOLEAN, col2 = BOOLEAN, col3 = BOOLEAN, col4 = BOOLEAN)

Provided by

The json extension (LOAD json;).


DuckDB function json_structure

Description

DuckDB function json_structure().

Usage

json_structure(col0)

Arguments

col0

VARCHAR | JSON

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function json_transform

Description

DuckDB function json_transform().

Usage

json_transform(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

ANY

Provided by

The json extension (LOAD json;).


DuckDB function json_transform_strict

Description

DuckDB function json_transform_strict().

Usage

json_transform_strict(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

ANY

Provided by

The json extension (LOAD json;).


DuckDB function json_tree

Description

DuckDB function json_tree().

Usage

json_tree(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR

Value

Unspecified.

Overloads

  • json_tree(col0 = VARCHAR)

  • json_tree(col0 = VARCHAR, col1 = VARCHAR)

  • json_tree(col0 = JSON)

  • json_tree(col0 = JSON, col1 = VARCHAR)

Provided by

The json extension (LOAD json;).


DuckDB function json_type

Description

DuckDB function json_type().

Usage

json_type(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

VARCHAR | VARCHAR[]

Value

VARCHAR | VARCHAR[]

Overloads

  • json_type(col0 = VARCHAR)

  • json_type(col0 = VARCHAR, col1 = VARCHAR)

  • json_type(col0 = VARCHAR, col1 = `VARCHAR[]`)

  • json_type(col0 = JSON)

  • json_type(col0 = JSON, col1 = VARCHAR)

  • json_type(col0 = JSON, col1 = `VARCHAR[]`)

Provided by

The json extension (LOAD json;).


DuckDB function json_valid

Description

DuckDB function json_valid().

Usage

json_valid(col0)

Arguments

col0

VARCHAR | JSON

Value

BOOLEAN

Provided by

The json extension (LOAD json;).


DuckDB function json_value

Description

DuckDB function json_value().

Usage

json_value(col0, col1)

Arguments

col0

VARCHAR | JSON

col1

BIGINT | VARCHAR | VARCHAR[]

Value

VARCHAR | VARCHAR[]

Provided by

The json extension (LOAD json;).


DuckDB function julian

Description

Extract the Julian Day number from a date or timestamp.

Usage

julian(ts)

Arguments

ts

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

DOUBLE

SQL examples

julian(timestamp '2006-01-01 12:00')

DuckDB function kahan_sum

Description

Calculates the sum using a more accurate floating point summation (Kahan Sum).

Usage

kahan_sum(arg)

Arguments

arg

DOUBLE

Value

DOUBLE

SQL examples

kahan_sum(A)

DuckDB function kurtosis

Description

Returns the excess kurtosis (Fisher’s definition) of all input values, with a bias correction according to the sample size.

Usage

kurtosis(x)

Arguments

x

DOUBLE

Value

DOUBLE


DuckDB function kurtosis_pop

Description

Returns the excess kurtosis (Fisher’s definition) of all input values, without bias correction.

Usage

kurtosis_pop(x)

Arguments

x

DOUBLE

Value

DOUBLE


DuckDB function lag

Description

DuckDB function lag().

Usage

lag(col0, col1, col2)

Arguments

col0

T

col1

BIGINT

col2

T

Value

T


DuckDB function lance_fts

Description

DuckDB function lance_fts().

Usage

lance_fts(col0, col1, col2, filter, prefilter, k)

Arguments

col0

VARCHAR

col1

VARCHAR

col2

VARCHAR

filter

VARCHAR

prefilter

BOOLEAN

k

BIGINT

Value

Unspecified.

Provided by

The lance extension (LOAD lance;).


DuckDB function last

Description

Returns the last value of a column. This function is affected by ordering.

Usage

last(arg)

Arguments

arg

DECIMAL | ANY

Value

DECIMAL | ANY | T

Overloads

  • last(arg = DECIMAL)

  • last(arg = ANY)

  • last(col0 = T)

SQL examples

last(A)

DuckDB function last_day

Description

Returns the last day of the month.

Usage

last_day(ts)

Arguments

ts

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

DATE

SQL examples

last_day(TIMESTAMP '1992-03-22 01:02:03.1234')

DuckDB function last_value

Description

DuckDB function last_value().

Usage

last_value(col0)

Arguments

col0

T

Value

T


DuckDB function lead

Description

DuckDB function lead().

Usage

lead(col0, col1, col2)

Arguments

col0

T

col1

BIGINT

col2

T

Value

T


DuckDB function least_common_multiple

Description

Computes the least common multiple of x and y.

Usage

least_common_multiple(x, y)

Arguments

x, y

BIGINT | HUGEINT

Value

BIGINT | HUGEINT

SQL examples

least_common_multiple(42, 57)

DuckDB function len

Description

  • len(string = VARCHAR): Number of characters in string.

  • len(bit = BIT): Returns the bit-length of the bit argument.

  • len(list = `ANY[]`): Returns the length of the list.

Usage

len(string)

Arguments

string

VARCHAR

Value

BIGINT

Overloads

  • len(string = VARCHAR)

  • len(bit = BIT)

  • len(list = `ANY[]`)

SQL examples

length('Hello🦆')
length(42::TINYINT::BIT)
length([1,2,3])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()

Other numeric: bin(), bit_length(), formatReadableDecimalSize(), format_bytes(), greatest(), hex(), least(), parse_formatted_bytes(), to_base()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function levenshtein

Description

The minimum number of single-character edits (insertions, deletions or substitutions) required to change one string to the other. Characters of different cases (e.g., a and A) are considered different.

Usage

levenshtein(s1, s2)

Arguments

s1, s2

VARCHAR

Value

BIGINT

SQL examples

levenshtein('duck', 'db')

See Also

Other text_similarity: damerau_levenshtein(), hamming(), jaccard(), jaro_similarity(), jaro_winkler_similarity()


DuckDB function lgamma

Description

Computes the log of the gamma function.

Usage

lgamma(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

lgamma(2)

DuckDB function like_escape

Description

Returns true if the string matches the like_specifier (see Pattern Matching) using case-sensitive matching. escape_character is used to search for wildcard characters in the string.

Usage

like_escape(string, like_specifier, escape_character)

Arguments

string, like_specifier, escape_character

VARCHAR

Value

BOOLEAN

SQL examples

like_escape('a%c', 'a$%c', '$')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function list_any_value

Description

DuckDB macro list_any_value().

Usage

list_any_value(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_append

Description

DuckDB macro list_append().

Usage

list_append(l, e)

Arguments

l, e

Unspecified.

Value

Unspecified.


DuckDB function list_approx_count_distinct

Description

DuckDB macro list_approx_count_distinct().

Usage

list_approx_count_distinct(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_avg

Description

DuckDB macro list_avg().

Usage

list_avg(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_bit_and

Description

DuckDB macro list_bit_and().

Usage

list_bit_and(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_bit_or

Description

DuckDB macro list_bit_or().

Usage

list_bit_or(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_bit_xor

Description

DuckDB macro list_bit_xor().

Usage

list_bit_xor(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_bool_and

Description

DuckDB macro list_bool_and().

Usage

list_bool_and(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_bool_or

Description

DuckDB macro list_bool_or().

Usage

list_bool_or(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_cosine_distance

Description

Computes the cosine distance between two same-sized lists.

Usage

list_cosine_distance(list1, list2)

Arguments

list1, list2

FLOAT[] | DOUBLE[]

Value

FLOAT | DOUBLE

SQL examples

list_cosine_distance([1, 2, 3], [1, 2, 3])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_cosine_similarity

Description

Computes the cosine similarity between two same-sized lists.

Usage

list_cosine_similarity(list1, list2)

Arguments

list1, list2

FLOAT[] | DOUBLE[]

Value

FLOAT | DOUBLE

SQL examples

list_cosine_similarity([1, 2, 3], [1, 2, 3])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_count

Description

DuckDB macro list_count().

Usage

list_count(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_distance

Description

Calculates the Euclidean distance between two points with coordinates given in two inputs lists of equal length.

Usage

list_distance(list1, list2)

Arguments

list1, list2

FLOAT[] | DOUBLE[]

Value

FLOAT | DOUBLE

SQL examples

list_distance([1, 2, 3], [1, 2, 5])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_entropy

Description

DuckDB macro list_entropy().

Usage

list_entropy(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_filter

Description

Constructs a list from those elements of the input list for which the lambda function returns true. DuckDB must be able to cast the lambda function's return type to BOOL. The return type of list_filter is the same as the input list's.

Usage

list_filter(list, lambda)

Arguments

list

ANY[]

lambda

LAMBDA

Value

ANY[]

SQL examples

list_filter([3, 4, 5], lambda x : x > 4)

See Also

Other lambda: list_reduce(), list_transform()

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_first

Description

DuckDB macro list_first().

Usage

list_first(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_grade_up

Description

Works like list_sort, but the results are the indexes that correspond to the position in the original list instead of the actual values.

Usage

list_grade_up(list, col1, col2)

Arguments

list

ANY[]

col1

VARCHAR

col2

VARCHAR

Value

ANY[]

Overloads

  • list_grade_up(list = `ANY[]`)

  • list_grade_up(list = `ANY[]`, col1 = VARCHAR)

  • list_grade_up(list = `ANY[]`, col1 = VARCHAR, col2 = VARCHAR)

SQL examples

list_grade_up([3, 6, 1, 2])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_histogram

Description

DuckDB macro list_histogram().

Usage

list_histogram(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_kurtosis

Description

DuckDB macro list_kurtosis().

Usage

list_kurtosis(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_kurtosis_pop

Description

DuckDB macro list_kurtosis_pop().

Usage

list_kurtosis_pop(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_last

Description

DuckDB macro list_last().

Usage

list_last(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_mad

Description

DuckDB macro list_mad().

Usage

list_mad(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_max

Description

DuckDB macro list_max().

Usage

list_max(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_median

Description

DuckDB macro list_median().

Usage

list_median(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_min

Description

DuckDB macro list_min().

Usage

list_min(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_mode

Description

DuckDB macro list_mode().

Usage

list_mode(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_negative_inner_product

Description

Computes the negative inner product between two same-sized lists.

Usage

list_negative_inner_product(list1, list2)

Arguments

list1, list2

FLOAT[] | DOUBLE[]

Value

FLOAT | DOUBLE

SQL examples

list_negative_inner_product([1, 2, 3], [1, 2, 3])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_position

Description

Returns the index of the element if the list contains the element. If the element is not found, it returns NULL.

Usage

list_position(list, element)

Arguments

list

T[]

element

T

Value

INTEGER

SQL examples

list_position([1, 2, NULL], 2)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_prepend

Description

DuckDB macro list_prepend().

Usage

list_prepend(e, l)

Arguments

e, l

Unspecified.

Value

Unspecified.


DuckDB function list_product

Description

DuckDB macro list_product().

Usage

list_product(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_reduce

Description

Reduces all elements of the input list into a single scalar value by executing the lambda function on a running result and the next list element. The lambda function has an optional initial_value argument.

Usage

list_reduce(list, lambda, initial_value)

Arguments

list

ANY[]

lambda

LAMBDA

initial_value

ANY

Value

ANY

Overloads

  • list_reduce(list = `ANY[]`, lambda = LAMBDA)

  • list_reduce(list = `ANY[]`, lambda = LAMBDA, initial_value = ANY)

SQL examples

list_reduce([1, 2, 3], lambda x, y : x + y)

See Also

Other lambda: list_filter(), list_transform()

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_resize

Description

Resizes the list to contain size elements. Initializes new elements with value or NULL if value is not set.

Usage

list_resize(list, size, value)

Arguments

list

ANY[]

size

ANY

value

ANY

Value

ANY[]

Overloads

  • list_resize(list = `ANY[]`, size = ANY)

  • list_resize(list = `ANY[]`, size = ANY, value = ANY)

SQL examples

list_resize([1, 2, 3], 5, 0)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_reverse

Description

DuckDB macro list_reverse().

Usage

list_reverse(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_reverse_sort

Description

Sorts the elements of the list in reverse order.

Usage

list_reverse_sort(list, col1)

Arguments

list

ANY[]

col1

VARCHAR

Value

ANY[]

Overloads

  • list_reverse_sort(list = `ANY[]`)

  • list_reverse_sort(list = `ANY[]`, col1 = VARCHAR)

SQL examples

list_reverse_sort([3, 6, 1, 2])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_sem

Description

DuckDB macro list_sem().

Usage

list_sem(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_skewness

Description

DuckDB macro list_skewness().

Usage

list_skewness(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_slice

Description

  • list_slice(list = ANY, begin = ANY, end = ANY): Extracts a sublist or substring using slice conventions. Negative values are accepted.

  • list_slice(list = ANY, begin = ANY, end = ANY, step = BIGINT): list_slice with added step feature.

Usage

list_slice(list, begin, end, step)

Arguments

list

ANY

begin

ANY

end

ANY

step

BIGINT

Value

ANY

Overloads

  • list_slice(list = ANY, begin = ANY, end = ANY)

  • list_slice(list = ANY, begin = ANY, end = ANY, step = BIGINT)

SQL examples

list_slice([4, 5, 6], 2, 3)
list_slice([4, 5, 6], 1, 3, 2)
array_slice('DuckDB', 3, 4)
array_slice('DuckDB', 3, NULL)
array_slice('DuckDB', 0, -3)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function list_sort

Description

Sorts the elements of the list.

Usage

list_sort(list, col1, col2)

Arguments

list

ANY[]

col1

VARCHAR

col2

VARCHAR

Value

ANY[]

Overloads

  • list_sort(list = `ANY[]`)

  • list_sort(list = `ANY[]`, col1 = VARCHAR)

  • list_sort(list = `ANY[]`, col1 = VARCHAR, col2 = VARCHAR)

SQL examples

list_sort([3, 6, 1, 2])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_stddev_pop

Description

DuckDB macro list_stddev_pop().

Usage

list_stddev_pop(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_stddev_samp

Description

DuckDB macro list_stddev_samp().

Usage

list_stddev_samp(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_string_agg

Description

DuckDB macro list_string_agg().

Usage

list_string_agg(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_sum

Description

DuckDB macro list_sum().

Usage

list_sum(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_transform

Description

Returns a list that is the result of applying the lambda function to each element of the input list. The return type is defined by the return type of the lambda function.

Usage

list_transform(list, lambda)

Arguments

list

ANY[]

lambda

LAMBDA

Value

ANY[]

SQL examples

list_transform([1, 2, 3], lambda x : x + 1)

See Also

Other lambda: list_filter(), list_reduce()

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_var_pop

Description

DuckDB macro list_var_pop().

Usage

list_var_pop(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_var_samp

Description

DuckDB macro list_var_samp().

Usage

list_var_samp(l)

Arguments

l

Unspecified.

Value

Unspecified.


DuckDB function list_where

Description

Returns a list with the BOOLEANs in mask_list applied as a mask to the value_list.

Usage

list_where(value_list, mask_list)

Arguments

value_list

T[]

mask_list

BOOLEAN[]

Value

T[]

SQL examples

list_where([10, 20, 30, 40], [true, false, false, true])

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_zip(), or–or, range(), repeat(), unpivot_list()


DuckDB function list_zip

Description

Zips n LISTs to a new LIST whose length will be that of the longest list. Its elements are structs of n elements from each list list_1, …, list_n, missing elements are replaced with NULL. If truncate is set, all lists are truncated to the smallest list length.

Usage

list_zip()

Value

STRUCT[]

SQL examples

list_zip([1, 2], [3, 4], [5, 6])
list_zip([1, 2], [3, 4], [5, 6, 7])
list_zip([1, 2], [3, 4], [5, 6, 7], true)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), or–or, range(), repeat(), unpivot_list()


DuckDB function ln

Description

Computes the natural logarithm of x.

Usage

ln(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

ln(2)

DuckDB function load_aws_credentials

Description

DuckDB function load_aws_credentials().

Usage

load_aws_credentials(col0, redact_secret, set_region)

Arguments

col0

VARCHAR

redact_secret

BOOLEAN

set_region

BOOLEAN

Value

Unspecified.

Overloads

  • load_aws_credentials(redact_secret = BOOLEAN, set_region = BOOLEAN)

  • load_aws_credentials(col0 = VARCHAR, redact_secret = BOOLEAN, set_region = BOOLEAN)

Provided by

The aws extension (LOAD aws;).


DuckDB function log

Description

Computes the logarithm of x to base b. b may be omitted, in which case the default 10.

Usage

log(b, x)

Arguments

b, x

DOUBLE

Value

DOUBLE

Overloads

  • log(b = DOUBLE)

  • log(b = DOUBLE, x = DOUBLE)

SQL examples

log(2, 64)

DuckDB function log10

Description

Computes the 10-log of x.

Usage

log10(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

log10(1000)

DuckDB function log2

Description

Computes the 2-log of x.

Usage

log2(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

log2(8)

DuckDB function lpad

Description

Pads the string with the character on the left until it has count characters. Truncates the string on the right if it has more than count characters.

Usage

lpad(string, count, character)

Arguments

string

VARCHAR

count

INTEGER

character

VARCHAR

Value

VARCHAR

SQL examples

lpad('hello', 8, '>')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function ltrim

Description

Removes any occurrences of any of the characters from the left side of the string. characters defaults to space.

Usage

ltrim(string, characters)

Arguments

string, characters

VARCHAR

Value

VARCHAR

Overloads

  • ltrim(string = VARCHAR)

  • ltrim(string = VARCHAR, characters = VARCHAR)

SQL examples

ltrim('    test  ')
ltrim('>>>>test<<', '><')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function mad

Description

Returns the median absolute deviation for the values within x. NULL values are ignored. Temporal types return a positive INTERVAL. .

Usage

mad(x)

Arguments

x

⁠DECIMAL | FLOAT | DOUBLE | DATE | TIMESTAMP | TIME | TIMESTAMP WITH TIME ZONE | TIME WITH TIME ZONE⁠

Value

DECIMAL | FLOAT | DOUBLE | INTERVAL

SQL examples

mad(x)

DuckDB function make_date

Description

  • make_date(year = BIGINT, month = BIGINT, day = BIGINT): The date for the given parts.

  • make_date(date.struct = `STRUCT("year" BIGINT, "month" BIGINT, "day" BIGINT)`): The date for the given struct.

  • make_date(col0 = INTEGER): (Description missing.)

Usage

make_date(year, month, day)

Arguments

year, month, day

BIGINT

Value

DATE

Overloads

  • make_date(col0 = INTEGER)

  • make_date(year = BIGINT, month = BIGINT, day = BIGINT)

  • make_date(date.struct = `STRUCT("year" BIGINT, "month" BIGINT, "day" BIGINT)`)

SQL examples

make_date(1992, 9, 20)
make_date({'year': 2024, 'month': 11, 'day': 14})

DuckDB function make_time

Description

The time for the given parts.

Usage

make_time(hour, minute, seconds)

Arguments

hour

BIGINT

minute

BIGINT

seconds

DOUBLE

Value

TIME

SQL examples

make_time(13, 34, 27.123456)

DuckDB function make_timestamp

Description

The timestamp for the given parts.

Usage

make_timestamp(year, month, day, hour, minute, seconds)

Arguments

year

BIGINT

month

BIGINT

day

BIGINT

hour

BIGINT

minute

BIGINT

seconds

DOUBLE

Value

TIMESTAMP

Overloads

  • make_timestamp(year = BIGINT, month = BIGINT, day = BIGINT, hour = BIGINT, minute = BIGINT, seconds = DOUBLE)

  • make_timestamp(year = BIGINT)

SQL examples

make_timestamp(1992, 9, 20, 13, 34, 27.123456)

DuckDB function make_timestamp_ms

Description

The timestamp for the given microseconds since the epoch.

Usage

make_timestamp_ms(nanos)

Arguments

nanos

BIGINT

Value

TIMESTAMP

SQL examples

make_timestamp_ms(1732117793000000)

DuckDB function make_timestamp_ns

Description

The timestamp for the given nanoseconds since epoch.

Usage

make_timestamp_ns(nanos)

Arguments

nanos

BIGINT

Value

TIMESTAMP_NS

SQL examples

make_timestamp_ns(1732117793000000000)

DuckDB function make_timestamptz

Description

DuckDB function make_timestamptz().

Usage

make_timestamptz(col0, col1, col2, col3, col4, col5, col6)

Arguments

col0

BIGINT

col1

BIGINT

col2

BIGINT

col3

BIGINT

col4

BIGINT

col5

DOUBLE

col6

VARCHAR

Value

⁠TIMESTAMP WITH TIME ZONE⁠

Overloads

  • make_timestamptz(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT, col3 = BIGINT, col4 = BIGINT, col5 = DOUBLE)

  • make_timestamptz(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT, col3 = BIGINT, col4 = BIGINT, col5 = DOUBLE, col6 = VARCHAR)

  • make_timestamptz(col0 = BIGINT)

Provided by

The icu extension (LOAD icu;).


DuckDB function make_type

Description

Construct a type from its name and optional parameters.

Usage

make_type(name)

Arguments

name

VARCHAR

Value

TYPE

SQL examples

make_type('DECIMAL', 10, 2)

DuckDB function map

Description

Creates a map from a set of keys and values.

Usage

map(keys, values)

Arguments

keys

K[]

values

V[]

Value

MAP("NULL", "NULL") | MAP(K, V)

Overloads

  • map()

  • map(keys = `K[]`, values = `V[]`)

SQL examples

map(['key1', 'key2'], ['val1', 'val2'])

DuckDB function map_concat

Description

Returns a map created from merging the input maps, on key collision the value is taken from the last map with that key.

Usage

map_concat()

Value

LIST

SQL examples

map_concat(map([1, 2], ['a', 'b']), map([2, 3], ['c', 'd']));

DuckDB function map_contains

Description

Checks if a map contains a given key.

Usage

map_contains(map, key)

Arguments

map

MAP(K, V)

key

K

Value

BOOLEAN

SQL examples

map_contains(MAP {'key1': 10, 'key2': 20, 'key3': 30}, 'key2')

DuckDB function map_contains_entry

Description

DuckDB macro map_contains_entry().

Usage

map_contains_entry(map, key, value)

Arguments

map, key, value

Unspecified.

Value

Unspecified.


DuckDB function map_contains_value

Description

DuckDB macro map_contains_value().

Usage

map_contains_value(map, value)

Arguments

map, value

Unspecified.

Value

Unspecified.


DuckDB function map_entries

Description

Returns the map entries as a list of keys/values.

Usage

map_entries(map)

Arguments

map

MAP(K, V)

Value

⁠STRUCT("key" K, "value" V)[]⁠

SQL examples

map_entries(map(['key'], ['val']))

DuckDB function map_extract

Description

Returns a list containing the value for a given key or an empty list if the key is not contained in the map. The type of the key provided in the second parameter must match the type of the map’s keys else an error is returned.

Usage

map_extract(map, key)

Arguments

map

MAP(K, V)

key

K

Value

V[]

SQL examples

map_extract(map(['key'], ['val']), 'key')

DuckDB function map_extract_value

Description

Returns the value for a given key or NULL if the key is not contained in the map. The type of the key provided in the second parameter must match the type of the map’s keys else an error is returned.

Usage

map_extract_value(map, key)

Arguments

map

MAP(K, V)

key

K

Value

V

SQL examples

map_extract_value(map(['key'], ['val']), 'key')

DuckDB function map_from_entries

Description

Returns a map created from the entries of the array.

Usage

map_from_entries(map)

Arguments

map

STRUCT(K, V)[]

Value

MAP(K, V)

SQL examples

map_from_entries([{k: 5, v: 'val1'}, {k: 3, v: 'val2'}]);

DuckDB function map_keys

Description

Returns the keys of a map as a list.

Usage

map_keys(map)

Arguments

map

MAP(K, V)

Value

K[]

SQL examples

map_keys(map(['key'], ['val']))

DuckDB function map_to_pg_oid

Description

DuckDB macro map_to_pg_oid().

Usage

map_to_pg_oid(type_name)

Arguments

type_name

Unspecified.

Value

Unspecified.


DuckDB function map_values

Description

Returns the values of a map as a list.

Usage

map_values(map)

Arguments

map

MAP(K, V)

Value

V[]

SQL examples

map_values(map(['key'], ['val']))

DuckDB function max

Description

Returns the maximum value present in arg.

Usage

max(arg, col1)

Arguments

arg

ANY

col1

BIGINT

Value

ANY | ANY[]

Overloads

  • max(arg = ANY)

  • max(arg = ANY, col1 = BIGINT)

SQL examples

max(A)

DuckDB function md5_number

Description

  • md5_number(string = VARCHAR): Returns the MD5 hash of the string as a HUGEINT.

  • md5_number(blob = BLOB): Returns the MD5 hash of the blob as a HUGEINT.

Usage

md5_number(string)

Arguments

string

VARCHAR

Value

UHUGEINT

Overloads

  • md5_number(string = VARCHAR)

  • md5_number(blob = BLOB)

SQL examples

md5_number('abc')
md5_number('\xAA\xBB'::BLOB)

See Also

Other blob: decode(), encode(), from_base64(), hex(), md5(), octet_length(), or–or, repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function md5_number_lower

Description

DuckDB macro md5_number_lower().

Usage

md5_number_lower(param)

Arguments

param

Unspecified.

Value

Unspecified.


DuckDB function md5_number_upper

Description

DuckDB macro md5_number_upper().

Usage

md5_number_upper(param)

Arguments

param

Unspecified.

Value

Unspecified.


DuckDB function median

Description

Returns the middle value of the set. NULL values are ignored. For even value counts, interpolate-able types (numeric, date/time) return the average of the two middle values. Non-interpolate-able types (everything else) return the lower of the two middle values.

Usage

median(x)

Arguments

x

ANY

Value

ANY

SQL examples

median(x)

DuckDB function metadata_info

Description

DuckDB function metadata_info().

Usage

metadata_info()

Value

Unspecified.


DuckDB function microsecond

Description

Extract the microsecond component from a date or timestamp.

Usage

microsecond(ts)

Arguments

ts

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

microsecond(timestamp '2021-08-03 11:59:44.123456')

DuckDB function millennium

Description

Extract the millennium component from a date or timestamp.

Usage

millennium(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

millennium(timestamp '2021-08-03 11:59:44.123456')

DuckDB function millisecond

Description

Extract the millisecond component from a date or timestamp.

Usage

millisecond(ts)

Arguments

ts

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

millisecond(timestamp '2021-08-03 11:59:44.123456')

DuckDB function min

Description

Returns the minimum value present in arg.

Usage

min(arg, col1)

Arguments

arg

ANY

col1

BIGINT

Value

ANY | ANY[]

Overloads

  • min(arg = ANY)

  • min(arg = ANY, col1 = BIGINT)

SQL examples

min(A)

DuckDB function minute

Description

Extract the minute component from a date or timestamp.

Usage

minute(ts)

Arguments

ts

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

minute(timestamp '2021-08-03 11:59:44.123456')

DuckDB function mod

Description

DuckDB function mod().

Usage

mod(col0, col1)

Arguments

col0, col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT


DuckDB function mode

Description

Returns the most frequent value for the values within x. NULL values are ignored.

Usage

mode(x)

Arguments

x

ANY

Value

ANY


DuckDB function month

Description

Extract the month component from a date or timestamp.

Usage

month(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

month(timestamp '2021-08-03 11:59:44.123456')

DuckDB function monthname

Description

The (English) name of the month.

Usage

monthname(ts)

Arguments

ts

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

VARCHAR

SQL examples

monthname(TIMESTAMP '1992-09-20')

DuckDB function multiply

Description

DuckDB function multiply().

Usage

multiply(col0, col1)

Arguments

col0, col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | INTERVAL

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | INTERVAL


DuckDB function murmur3_32

Description

DuckDB function murmur3_32().

Usage

murmur3_32(col0)

Arguments

col0

ANY

Value

INTEGER

Provided by

The ducklake extension (LOAD ducklake;).


DuckDB function mysql_clear_cache

Description

DuckDB function mysql_clear_cache().

Usage

mysql_clear_cache()

Value

Unspecified.

Provided by

The mysql_scanner extension (LOAD mysql_scanner;).


DuckDB function mysql_debug_execution_plan

Description

DuckDB function mysql_debug_execution_plan().

Usage

mysql_debug_execution_plan()

Value

Unspecified.

Provided by

The mysql_scanner extension (LOAD mysql_scanner;).


DuckDB function mysql_execute

Description

DuckDB function mysql_execute().

Usage

mysql_execute(col0, col1, params)

Arguments

col0

VARCHAR

col1

VARCHAR

params

ANY

Value

Unspecified.

Provided by

The mysql_scanner extension (LOAD mysql_scanner;).


DuckDB function mysql_explain_federated

Description

DuckDB function mysql_explain_federated().

Usage

mysql_explain_federated()

Value

Unspecified.

Provided by

The mysql_scanner extension (LOAD mysql_scanner;).


DuckDB function mysql_query

Description

DuckDB function mysql_query().

Usage

mysql_query(col0, col1, stream_results, params)

Arguments

col0

VARCHAR

col1

VARCHAR

stream_results

BOOLEAN

params

ANY

Value

Unspecified.

Provided by

The mysql_scanner extension (LOAD mysql_scanner;).


DuckDB function nanosecond

Description

Extract the nanosecond component from a date or timestamp.

Usage

nanosecond(tsns)

Arguments

tsns

⁠DATE | TIMESTAMP | INTERVAL | TIME | TIME_NS | TIME WITH TIME ZONE | TIMESTAMP_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

nanosecond(timestamp_ns '2021-08-03 11:59:44.123456789')

DuckDB function netmask

Description

DuckDB function netmask().

Usage

netmask(col0)

Arguments

col0

INET

Value

INET

Provided by

The inet extension (LOAD inet;).


DuckDB function network

Description

DuckDB function network().

Usage

network(col0)

Arguments

col0

INET

Value

INET

Provided by

The inet extension (LOAD inet;).


DuckDB function nextafter

Description

Returns the next floating point value after x in the direction of y.

Usage

nextafter(x, y)

Arguments

x, y

DOUBLE | FLOAT

Value

DOUBLE | FLOAT

SQL examples

nextafter(1::float, 2::float)

DuckDB function nextval

Description

Return the following value of the sequence.

Usage

nextval(sequence_name)

Arguments

sequence_name

VARCHAR

Value

BIGINT

SQL examples

nextval('my_sequence_name')

DuckDB function normalized_interval

Description

Normalizes an INTERVAL to an equivalent interval.

Usage

normalized_interval(interval)

Arguments

interval

INTERVAL

Value

INTERVAL

SQL examples

normalized_interval(INTERVAL '30 days')

DuckDB function not_ilike_escape

Description

Returns false if the string matches the like_specifier (see Pattern Matching) using case-insensitive matching. escape_character is used to search for wildcard characters in the string.

Usage

not_ilike_escape(string, like_specifier, escape_character)

Arguments

string, like_specifier, escape_character

VARCHAR

Value

BOOLEAN

SQL examples

not_ilike_escape('A%c', 'a$%C', '$')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function not_like_escape

Description

Returns false if the string matches the like_specifier (see Pattern Matching) using case-sensitive matching. escape_character is used to search for wildcard characters in the string.

Usage

not_like_escape(string, like_specifier, escape_character)

Arguments

string, like_specifier, escape_character

VARCHAR

Value

BOOLEAN

SQL examples

not_like_escape('a%c', 'a$%c', '$')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function !~~

Description

DuckDB function ⁠!~~()⁠.

Usage

`!~~`(col0, col1)

Arguments

col0, col1

VARCHAR

Value

BOOLEAN


DuckDB function !~~*

Description

DuckDB function ⁠!~~*()⁠.

Usage

`!~~*`(col0, col1)

Arguments

col0, col1

VARCHAR

Value

BOOLEAN


DuckDB function nth_value

Description

DuckDB function nth_value().

Usage

nth_value(col0, col1)

Arguments

col0

T

col1

BIGINT

Value

T


DuckDB function ntile

Description

DuckDB function ntile().

Usage

ntile(col0)

Arguments

col0

BIGINT

Value

BIGINT


DuckDB function nullif

Description

DuckDB macro nullif().

Usage

nullif(a, b)

Arguments

a, b

Unspecified.

Value

Unspecified.


DuckDB function obj_description

Description

DuckDB macro obj_description().

Usage

obj_description(object_oid, catalog_name)

Arguments

object_oid, catalog_name

Unspecified.

Value

Unspecified.


DuckDB function octet_length

Description

  • octet_length(blob = BLOB): Number of bytes in blob.

  • octet_length(bitstring = BIT): Returns the number of bytes in the bitstring.

Usage

octet_length(blob)

Arguments

blob

BLOB

Value

BIGINT

Overloads

  • octet_length(blob = BLOB)

  • octet_length(bitstring = BIT)

SQL examples

octet_length('\xAA\xBB'::BLOB)
octet_length('1101011'::BITSTRING)

See Also

Other blob: decode(), encode(), from_base64(), hex(), md5(), md5_number(), or–or, repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()


DuckDB function |

Description

Bitwise OR.

Usage

`|`(left, right)

Arguments

left, right

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

32 | 3

DuckDB function ||

Description

Concatenates two strings, lists, or blobs. Any NULL input results in NULL. See also concat(arg1, arg2, ...) and list_concat(list1, list2, ...).

Usage

`||`(arg1, arg2)

Arguments

arg1, arg2

ANY

Value

ANY

SQL examples

'Duck' || 'DB'
[1, 2, 3] || [4, 5, 6]
'\xAA'::BLOB || '\xBB'::BLOB

See Also

Other blob: decode(), encode(), from_base64(), hex(), md5(), md5_number(), octet_length(), repeat(), sha1(), sha256(), to_base64(), unbin(), unhex()

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), range(), repeat(), unpivot_list()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function parquet_bloom_probe

Description

DuckDB function parquet_bloom_probe().

Usage

parquet_bloom_probe(col0, col1, col2)

Arguments

col0

VARCHAR | VARCHAR[]

col1

VARCHAR

col2

ANY

Value

Unspecified.


DuckDB function parquet_file_metadata

Description

DuckDB function parquet_file_metadata().

Usage

parquet_file_metadata(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function parquet_full_metadata

Description

DuckDB function parquet_full_metadata().

Usage

parquet_full_metadata(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function parquet_kv_metadata

Description

DuckDB function parquet_kv_metadata().

Usage

parquet_kv_metadata(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function parquet_metadata

Description

DuckDB function parquet_metadata().

Usage

parquet_metadata(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function parquet_scan

Description

DuckDB function parquet_scan().

Usage

parquet_scan(
  col0,
  can_have_nan,
  filename,
  union_by_name,
  debug_use_openssl,
  hive_partitioning,
  parquet_version,
  encryption_config,
  hive_types_autocast,
  binary_as_string,
  explicit_cardinality,
  compression,
  file_row_number,
  hive_types,
  schema
)

Arguments

col0

VARCHAR | VARCHAR[]

can_have_nan

BOOLEAN

filename

ANY

union_by_name

BOOLEAN

debug_use_openssl

BOOLEAN

hive_partitioning

BOOLEAN

parquet_version

VARCHAR

encryption_config

ANY

hive_types_autocast

BOOLEAN

binary_as_string

BOOLEAN

explicit_cardinality

UBIGINT

compression

VARCHAR

file_row_number

BOOLEAN

hive_types

ANY

schema

ANY

Value

Unspecified.


DuckDB function parquet_schema

Description

DuckDB function parquet_schema().

Usage

parquet_schema(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function parse_delta_filter_logline

Description

DuckDB macro parse_delta_filter_logline().

Usage

parse_delta_filter_logline(x)

Arguments

x

Unspecified.

Value

Unspecified.

Provided by

The delta extension (LOAD delta;).


DuckDB function parse_dirname

Description

Returns the top-level directory name from the given path. separator options: system, both_slash (default), forward_slash, backslash.

Usage

parse_dirname(path, separator)

Arguments

path, separator

VARCHAR

Value

VARCHAR

Overloads

  • parse_dirname(path = VARCHAR)

  • parse_dirname(path = VARCHAR, separator = VARCHAR)

SQL examples

parse_dirname('path/to/file.csv', 'system')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function parse_dirpath

Description

Returns the head of the path (the pathname until the last slash) similarly to Python's os.path.dirname. separator options: system, both_slash (default), forward_slash, backslash.

Usage

parse_dirpath(path, separator)

Arguments

path, separator

VARCHAR

Value

VARCHAR

Overloads

  • parse_dirpath(path = VARCHAR)

  • parse_dirpath(path = VARCHAR, separator = VARCHAR)

SQL examples

parse_dirpath('path/to/file.csv', 'forward_slash')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function parse_duckdb_log_message

Description

Parse the message into the expected logical type.

Usage

parse_duckdb_log_message(type, message)

Arguments

type, message

VARCHAR

Value

ANY

SQL examples

parse_duckdb_log_message('FileSystem', log_message)

DuckDB function parse_filename

Description

Returns the last component of the path similarly to Python's os.path.basename function. If trim_extension is true, the file extension will be removed (defaults to false). separator options: system, both_slash (default), forward_slash, backslash.

Usage

parse_filename(string, trim_extension)

Arguments

string

VARCHAR

trim_extension

VARCHAR | BOOLEAN

Value

VARCHAR

Overloads

  • parse_filename(string = VARCHAR)

  • parse_filename(string = VARCHAR, trim_extension = VARCHAR)

  • parse_filename(string = VARCHAR, trim_extension = BOOLEAN)

  • parse_filename(string = VARCHAR, trim_extension = BOOLEAN, separator = VARCHAR)

SQL examples

parse_filename('path/to/file.csv', true, 'forward_slash')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function parse_path

Description

Returns a list of the components (directories and filename) in the path similarly to Python's pathlib.parts function. separator options: system, both_slash (default), forward_slash, backslash.

Usage

parse_path(path, separator)

Arguments

path, separator

VARCHAR

Value

VARCHAR[]

Overloads

  • parse_path(path = VARCHAR)

  • parse_path(path = VARCHAR, separator = VARCHAR)

SQL examples

parse_path('path/to/file.csv', 'system')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function percent_rank

Description

DuckDB function percent_rank().

Usage

percent_rank()

Value

DOUBLE


DuckDB function pg_clear_cache

Description

DuckDB function pg_clear_cache().

Usage

pg_clear_cache()

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function pg_collation_is_visible

Description

DuckDB macro pg_collation_is_visible().

Usage

pg_collation_is_visible(collation_oid)

Arguments

collation_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_conf_load_time

Description

DuckDB macro pg_conf_load_time().

Usage

pg_conf_load_time()

Value

Unspecified.


DuckDB function pg_conversion_is_visible

Description

DuckDB macro pg_conversion_is_visible().

Usage

pg_conversion_is_visible(conversion_oid)

Arguments

conversion_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_function_is_visible

Description

DuckDB macro pg_function_is_visible().

Usage

pg_function_is_visible(function_oid)

Arguments

function_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_get_constraintdef

Description

DuckDB function pg_get_constraintdef().

Usage

pg_get_constraintdef(constraint_oid, pretty_bool)

Arguments

constraint_oid, pretty_bool

Unspecified.

Value

Unspecified.

Overloads

  • pg_get_constraintdef(constraint_oid)

  • pg_get_constraintdef(constraint_oid, pretty_bool)


DuckDB function pg_get_expr

Description

DuckDB macro pg_get_expr().

Usage

pg_get_expr(pg_node_tree, relation_oid)

Arguments

pg_node_tree, relation_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_get_viewdef

Description

DuckDB macro pg_get_viewdef().

Usage

pg_get_viewdef(oid)

Arguments

oid

Unspecified.

Value

Unspecified.


DuckDB function pg_has_role

Description

DuckDB function pg_has_role().

Usage

pg_has_role(user, role, privilege)

Arguments

user, role, privilege

Unspecified.

Value

Unspecified.

Overloads

  • pg_has_role(user, role, privilege)

  • pg_has_role(role, privilege)


DuckDB function pg_is_other_temp_schema

Description

DuckDB macro pg_is_other_temp_schema().

Usage

pg_is_other_temp_schema(schema_id)

Arguments

schema_id

Unspecified.

Value

Unspecified.


DuckDB function pg_my_temp_schema

Description

DuckDB macro pg_my_temp_schema().

Usage

pg_my_temp_schema()

Value

Unspecified.


DuckDB function pg_opclass_is_visible

Description

DuckDB macro pg_opclass_is_visible().

Usage

pg_opclass_is_visible(opclass_oid)

Arguments

opclass_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_operator_is_visible

Description

DuckDB macro pg_operator_is_visible().

Usage

pg_operator_is_visible(operator_oid)

Arguments

operator_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_opfamily_is_visible

Description

DuckDB macro pg_opfamily_is_visible().

Usage

pg_opfamily_is_visible(opclass_oid)

Arguments

opclass_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_postmaster_start_time

Description

DuckDB macro pg_postmaster_start_time().

Usage

pg_postmaster_start_time()

Value

Unspecified.


DuckDB function pg_size_pretty

Description

DuckDB macro pg_size_pretty().

Usage

pg_size_pretty(bytes)

Arguments

bytes

Unspecified.

Value

Unspecified.


DuckDB function pg_sleep

Description

DuckDB macro pg_sleep().

Usage

pg_sleep(seconds)

Arguments

seconds

Unspecified.

Value

Unspecified.


DuckDB function pg_table_is_visible

Description

DuckDB macro pg_table_is_visible().

Usage

pg_table_is_visible(table_oid)

Arguments

table_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_timezone_names

Description

DuckDB function pg_timezone_names().

Usage

pg_timezone_names()

Value

Unspecified.

Provided by

The icu extension (LOAD icu;).


DuckDB function pg_ts_config_is_visible

Description

DuckDB macro pg_ts_config_is_visible().

Usage

pg_ts_config_is_visible(config_oid)

Arguments

config_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_ts_dict_is_visible

Description

DuckDB macro pg_ts_dict_is_visible().

Usage

pg_ts_dict_is_visible(dict_oid)

Arguments

dict_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_ts_parser_is_visible

Description

DuckDB macro pg_ts_parser_is_visible().

Usage

pg_ts_parser_is_visible(parser_oid)

Arguments

parser_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_ts_template_is_visible

Description

DuckDB macro pg_ts_template_is_visible().

Usage

pg_ts_template_is_visible(template_oid)

Arguments

template_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_type_is_visible

Description

DuckDB macro pg_type_is_visible().

Usage

pg_type_is_visible(type_oid)

Arguments

type_oid

Unspecified.

Value

Unspecified.


DuckDB function pg_typeof

Description

DuckDB macro pg_typeof().

Usage

pg_typeof(expression)

Arguments

expression

Unspecified.

Value

Unspecified.


DuckDB function pi

Description

Returns the value of pi.

Usage

pi()

Value

DOUBLE

SQL examples

pi()

DuckDB function platform

Description

DuckDB function platform().

Usage

platform()

Value

Unspecified.


DuckDB function postgres_attach

Description

DuckDB function postgres_attach().

Usage

postgres_attach(col0, suffix, sink_schema, filter_pushdown, source_schema, overwrite)

Arguments

col0

VARCHAR

suffix

VARCHAR

sink_schema

VARCHAR

filter_pushdown

BOOLEAN

source_schema

VARCHAR

overwrite

BOOLEAN

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_configure_pool

Description

DuckDB function postgres_configure_pool().

Usage

postgres_configure_pool(
  health_check_query,
  max_lifetime_millis,
  enable_reaper_thread,
  enable_thread_local_cache,
  wait_timeout_millis,
  max_connections,
  idle_timeout_millis,
  acquire_mode,
  catalog_name
)

Arguments

health_check_query

VARCHAR

max_lifetime_millis

UBIGINT

enable_reaper_thread

BOOLEAN

enable_thread_local_cache

BOOLEAN

wait_timeout_millis

UBIGINT

max_connections

UBIGINT

idle_timeout_millis

UBIGINT

acquire_mode

VARCHAR

catalog_name

VARCHAR

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_execute

Description

DuckDB function postgres_execute().

Usage

postgres_execute(col0, col1, use_transaction)

Arguments

col0

VARCHAR

col1

VARCHAR

use_transaction

BOOLEAN

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_hstore_get

Description

DuckDB function postgres_hstore_get().

Usage

postgres_hstore_get(col0, col1)

Arguments

col0, col1

VARCHAR

Value

VARCHAR

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_hstore_to_json

Description

DuckDB function postgres_hstore_to_json().

Usage

postgres_hstore_to_json(col0)

Arguments

col0

VARCHAR

Value

JSON

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_query

Description

DuckDB function postgres_query().

Usage

postgres_query(col0, col1, params, use_transaction)

Arguments

col0

VARCHAR

col1

VARCHAR

params

ANY

use_transaction

BOOLEAN

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_scan

Description

DuckDB function postgres_scan().

Usage

postgres_scan(col0, col1, col2)

Arguments

col0, col1, col2

VARCHAR

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function postgres_scan_pushdown

Description

DuckDB function postgres_scan_pushdown().

Usage

postgres_scan_pushdown(col0, col1, col2)

Arguments

col0, col1, col2

VARCHAR

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function pow

Description

Computes x to the power of y.

Usage

pow(x, y)

Arguments

x, y

DOUBLE

Value

DOUBLE

SQL examples

pow(2, 3)
power(2, 3)
2 ** 3
2 ^ 3

DuckDB function pragma_collations

Description

DuckDB function pragma_collations().

Usage

pragma_collations()

Value

Unspecified.


DuckDB function pragma_database_size

Description

DuckDB function pragma_database_size().

Usage

pragma_database_size()

Value

Unspecified.


DuckDB function pragma_hnsw_index_info

Description

DuckDB function pragma_hnsw_index_info().

Usage

pragma_hnsw_index_info()

Value

Unspecified.

Provided by

The vss extension (LOAD vss;).


DuckDB function pragma_metadata_info

Description

DuckDB function pragma_metadata_info().

Usage

pragma_metadata_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Overloads

  • pragma_metadata_info()

  • pragma_metadata_info(col0 = VARCHAR)


DuckDB function pragma_platform

Description

DuckDB function pragma_platform().

Usage

pragma_platform()

Value

Unspecified.


DuckDB function pragma_rtree_index_info

Description

DuckDB function pragma_rtree_index_info().

Usage

pragma_rtree_index_info()

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function pragma_show

Description

DuckDB function pragma_show().

Usage

pragma_show(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function pragma_storage_info

Description

DuckDB function pragma_storage_info().

Usage

pragma_storage_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function pragma_table_info

Description

DuckDB function pragma_table_info().

Usage

pragma_table_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function pragma_user_agent

Description

DuckDB function pragma_user_agent().

Usage

pragma_user_agent()

Value

Unspecified.


DuckDB function pragma_version

Description

DuckDB function pragma_version().

Usage

pragma_version()

Value

Unspecified.


DuckDB function product

Description

Calculates the product of all tuples in arg.

Usage

product(arg)

Arguments

arg

DOUBLE

Value

DOUBLE

SQL examples

product(A)

DuckDB function quack_active_connections

Description

DuckDB function quack_active_connections().

Usage

quack_active_connections()

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_check_token

Description

DuckDB function quack_check_token().

Usage

quack_check_token(col0, col1, col2)

Arguments

col0, col1, col2

VARCHAR

Value

BOOLEAN

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_clear_cache

Description

DuckDB function quack_clear_cache().

Usage

quack_clear_cache()

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_identify

Description

DuckDB function quack_identify().

Usage

quack_identify(meta, region, hostname, provider, name)

Arguments

meta, region, hostname, provider, name

VARCHAR

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_nop_authorization

Description

DuckDB function quack_nop_authorization().

Usage

quack_nop_authorization(col0, col1)

Arguments

col0, col1

VARCHAR

Value

VARCHAR

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_query

Description

DuckDB function quack_query().

Usage

quack_query(col0, col1, token, disable_ssl)

Arguments

col0

VARCHAR

col1

VARCHAR

token

VARCHAR

disable_ssl

BOOLEAN

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_query_by_name

Description

DuckDB function quack_query_by_name().

Usage

quack_query_by_name(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_serve

Description

DuckDB function quack_serve().

Usage

quack_serve(col0, token, allow_other_hostname, disable_ssl)

Arguments

col0

VARCHAR

token

VARCHAR

allow_other_hostname

BOOLEAN

disable_ssl

BOOLEAN

Value

Unspecified.

Overloads

  • quack_serve(col0 = VARCHAR, token = VARCHAR, allow_other_hostname = BOOLEAN, disable_ssl = BOOLEAN)

  • quack_serve(token = VARCHAR, allow_other_hostname = BOOLEAN, disable_ssl = BOOLEAN)

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_server_list

Description

DuckDB function quack_server_list().

Usage

quack_server_list()

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_stop

Description

DuckDB function quack_stop().

Usage

quack_stop(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function quack_uri_parser

Description

DuckDB function quack_uri_parser().

Usage

quack_uri_parser(col0, col1)

Arguments

col0

VARCHAR

col1

BOOLEAN

Value

⁠STRUCT(host VARCHAR, port USMALLINT, ipv6 BOOLEAN, ssl BOOLEAN, url VARCHAR)⁠

Provided by

The quack extension (LOAD quack;).


DuckDB function quantile_cont

Description

Returns the interpolated quantile number between 0 and 1 . If pos is a LIST of FLOATs, then the result is a LIST of the corresponding interpolated quantiles. .

Usage

quantile_cont(x, pos)

Arguments

x

⁠DECIMAL | TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DATE | TIMESTAMP | TIME | TIMESTAMP WITH TIME ZONE | TIME WITH TIME ZONE⁠

pos

DOUBLE | DOUBLE[]

Value

⁠DECIMAL | TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DATE | TIMESTAMP | TIME | TIMESTAMP WITH TIME ZONE | TIME WITH TIME ZONE⁠

SQL examples

quantile_cont(x, 0.5)

DuckDB function quantile_disc

Description

Returns the exact quantile number between 0 and 1 . If pos is a LIST of FLOATs, then the result is a LIST of the corresponding exact quantiles.

Usage

quantile_disc(x, pos)

Arguments

x

ANY

pos

DOUBLE | DOUBLE[]

Value

ANY

Overloads

  • quantile_disc(x = ANY, pos = DOUBLE)

  • quantile_disc(x = ANY, pos = `DOUBLE[]`)

  • quantile_disc(x = ANY)

SQL examples

quantile_disc(x, 0.5)

DuckDB function quarter

Description

Extract the quarter component from a date or timestamp.

Usage

quarter(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

quarter(timestamp '2021-08-03 11:59:44.123456')

DuckDB function query

Description

DuckDB function query().

Usage

query(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function query_table

Description

DuckDB function query_table().

Usage

query_table(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.

Overloads

  • query_table(col0 = VARCHAR)

  • query_table(col0 = `VARCHAR[]`)

  • query_table(col0 = `VARCHAR[]`, col1 = BOOLEAN)


DuckDB function r_dataframe_scan

Description

DuckDB function r_dataframe_scan().

Usage

r_dataframe_scan(col0, map_list_of, experimental, integer64)

Arguments

col0

POINTER

map_list_of

BOOLEAN

experimental

BOOLEAN

integer64

BOOLEAN

Value

Unspecified.


DuckDB function radians

Description

Converts degrees to radians.

Usage

radians(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

radians(90)

DuckDB function random

Description

Returns a random number between 0 and 1.

Usage

random()

Value

DOUBLE

SQL examples

random()

DuckDB function range

Description

Creates a list of values between start and stop - the stop parameter is exclusive.

Usage

range(start, stop, step)

Arguments

start

⁠BIGINT | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

stop

⁠BIGINT | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

step

BIGINT | INTERVAL

Value

⁠BIGINT[] | TIMESTAMP[] | TIMESTAMP WITH TIME ZONE[]⁠

Overloads

  • range(col0 = BIGINT)

  • range(col0 = BIGINT, col1 = BIGINT)

  • range(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT)

  • range(col0 = TIMESTAMP, col1 = TIMESTAMP, col2 = INTERVAL)

  • range(col0 = `TIMESTAMP WITH TIME ZONE`, col1 = `TIMESTAMP WITH TIME ZONE`, col2 = INTERVAL)

  • range(start = BIGINT)

  • range(start = BIGINT, stop = BIGINT)

  • range(start = BIGINT, stop = BIGINT, step = BIGINT)

  • range(start = TIMESTAMP, stop = TIMESTAMP, step = INTERVAL)

  • range(start = `TIMESTAMP WITH TIME ZONE`, stop = `TIMESTAMP WITH TIME ZONE`, step = INTERVAL)

Provided by

  • range(col0 = BIGINT): built in

  • range(col0 = BIGINT, col1 = BIGINT): built in

  • range(col0 = BIGINT, col1 = BIGINT, col2 = BIGINT): built in

  • range(col0 = TIMESTAMP, col1 = TIMESTAMP, col2 = INTERVAL): built in

  • range(col0 = `TIMESTAMP WITH TIME ZONE`, col1 = `TIMESTAMP WITH TIME ZONE`, col2 = INTERVAL): icu

  • range(start = BIGINT): built in

  • range(start = BIGINT, stop = BIGINT): built in

  • range(start = BIGINT, stop = BIGINT, step = BIGINT): built in

  • range(start = TIMESTAMP, stop = TIMESTAMP, step = INTERVAL): built in

  • range(start = `TIMESTAMP WITH TIME ZONE`, stop = `TIMESTAMP WITH TIME ZONE`, step = INTERVAL): built in

SQL examples

range(2, 5, 3)

See Also

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, repeat(), unpivot_list()


DuckDB function rank

Description

DuckDB function rank().

Usage

rank()

Value

BIGINT


DuckDB function rank_dense

Description

DuckDB function rank_dense().

Usage

rank_dense()

Value

BIGINT


DuckDB function read_avro

Description

DuckDB function read_avro().

Usage

read_avro(
  col0,
  hive_types_autocast,
  hive_types,
  hive_partitioning,
  union_by_name,
  filename
)

Arguments

col0

VARCHAR | VARCHAR[]

hive_types_autocast

BOOLEAN

hive_types

ANY

hive_partitioning

BOOLEAN

union_by_name

BOOLEAN

filename

ANY

Value

Unspecified.

Provided by

The avro extension (LOAD avro;).


DuckDB function read_blob

Description

DuckDB function read_blob().

Usage

read_blob(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function read_csv

Description

DuckDB function read_csv().

Usage

read_csv(
  col0,
  thousands,
  strict_mode,
  dtypes,
  column_types,
  null_padding,
  column_names,
  buffer_size,
  parallel,
  force_not_null,
  hive_types,
  new_line,
  files_to_sniff,
  dateformat,
  delim,
  sep,
  decimal_separator,
  nullstr,
  escape,
  compression,
  encoding,
  hive_types_autocast,
  all_varchar,
  columns,
  hive_partitioning,
  auto_detect,
  comment,
  quote,
  max_line_size,
  store_rejects,
  union_by_name,
  header,
  types,
  skip,
  filename,
  sample_size,
  timestampformat,
  normalize_names,
  ignore_errors,
  names,
  allow_quoted_nulls,
  maximum_line_size,
  rejects_table,
  auto_type_candidates,
  rejects_scan,
  rejects_limit
)

Arguments

col0

VARCHAR | VARCHAR[]

thousands

VARCHAR

strict_mode

BOOLEAN

dtypes

ANY

column_types

ANY

null_padding

BOOLEAN

column_names

VARCHAR[]

buffer_size

UBIGINT

parallel

BOOLEAN

force_not_null

VARCHAR[]

hive_types

ANY

new_line

VARCHAR

files_to_sniff

BIGINT

dateformat

VARCHAR

delim

VARCHAR

sep

VARCHAR

decimal_separator

VARCHAR

nullstr

ANY

escape

VARCHAR

compression

VARCHAR

encoding

VARCHAR

hive_types_autocast

BOOLEAN

all_varchar

BOOLEAN

columns

ANY

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

comment

VARCHAR

quote

VARCHAR

max_line_size

VARCHAR

store_rejects

BOOLEAN

union_by_name

BOOLEAN

header

BOOLEAN

types

ANY

skip

BIGINT

filename

ANY

sample_size

BIGINT

timestampformat

VARCHAR

normalize_names

BOOLEAN

ignore_errors

BOOLEAN

names

VARCHAR[]

allow_quoted_nulls

BOOLEAN

maximum_line_size

VARCHAR

rejects_table

VARCHAR

auto_type_candidates

ANY

rejects_scan

VARCHAR

rejects_limit

BIGINT

Value

Unspecified.


DuckDB function read_csv_auto

Description

DuckDB function read_csv_auto().

Usage

read_csv_auto(
  col0,
  thousands,
  strict_mode,
  dtypes,
  column_types,
  null_padding,
  column_names,
  buffer_size,
  parallel,
  force_not_null,
  hive_types,
  new_line,
  files_to_sniff,
  dateformat,
  delim,
  sep,
  decimal_separator,
  nullstr,
  escape,
  compression,
  encoding,
  hive_types_autocast,
  all_varchar,
  columns,
  hive_partitioning,
  auto_detect,
  comment,
  quote,
  max_line_size,
  store_rejects,
  union_by_name,
  header,
  types,
  skip,
  filename,
  sample_size,
  timestampformat,
  normalize_names,
  ignore_errors,
  names,
  allow_quoted_nulls,
  maximum_line_size,
  rejects_table,
  auto_type_candidates,
  rejects_scan,
  rejects_limit
)

Arguments

col0

VARCHAR | VARCHAR[]

thousands

VARCHAR

strict_mode

BOOLEAN

dtypes

ANY

column_types

ANY

null_padding

BOOLEAN

column_names

VARCHAR[]

buffer_size

UBIGINT

parallel

BOOLEAN

force_not_null

VARCHAR[]

hive_types

ANY

new_line

VARCHAR

files_to_sniff

BIGINT

dateformat

VARCHAR

delim

VARCHAR

sep

VARCHAR

decimal_separator

VARCHAR

nullstr

ANY

escape

VARCHAR

compression

VARCHAR

encoding

VARCHAR

hive_types_autocast

BOOLEAN

all_varchar

BOOLEAN

columns

ANY

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

comment

VARCHAR

quote

VARCHAR

max_line_size

VARCHAR

store_rejects

BOOLEAN

union_by_name

BOOLEAN

header

BOOLEAN

types

ANY

skip

BIGINT

filename

ANY

sample_size

BIGINT

timestampformat

VARCHAR

normalize_names

BOOLEAN

ignore_errors

BOOLEAN

names

VARCHAR[]

allow_quoted_nulls

BOOLEAN

maximum_line_size

VARCHAR

rejects_table

VARCHAR

auto_type_candidates

ANY

rejects_scan

VARCHAR

rejects_limit

BIGINT

Value

Unspecified.


DuckDB function read_duckdb

Description

DuckDB function read_duckdb().

Usage

read_duckdb(
  col0,
  table_name,
  schema_name,
  hive_types_autocast,
  hive_types,
  hive_partitioning,
  union_by_name,
  filename
)

Arguments

col0

VARCHAR | VARCHAR[]

table_name

VARCHAR

schema_name

VARCHAR

hive_types_autocast

BOOLEAN

hive_types

ANY

hive_partitioning

BOOLEAN

union_by_name

BOOLEAN

filename

ANY

Value

Unspecified.


DuckDB function read_json

Description

DuckDB function read_json().

Usage

read_json(
  col0,
  convert_strings_to_integers,
  maximum_sample_files,
  timestamp_format,
  field_appearance_threshold,
  timestampformat,
  map_inference_threshold,
  date_format,
  filename,
  union_by_name,
  compression,
  maximum_depth,
  columns,
  sample_size,
  hive_types,
  hive_types_autocast,
  maximum_object_size,
  format,
  ignore_errors,
  hive_partitioning,
  auto_detect,
  records,
  dateformat
)

Arguments

col0

VARCHAR | VARCHAR[]

convert_strings_to_integers

BOOLEAN

maximum_sample_files

BIGINT

timestamp_format

VARCHAR

field_appearance_threshold

DOUBLE

timestampformat

VARCHAR

map_inference_threshold

BIGINT

date_format

VARCHAR

filename

ANY

union_by_name

BOOLEAN

compression

VARCHAR

maximum_depth

BIGINT

columns

ANY

sample_size

BIGINT

hive_types

ANY

hive_types_autocast

BOOLEAN

maximum_object_size

UINTEGER

format

VARCHAR

ignore_errors

BOOLEAN

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

records

VARCHAR

dateformat

VARCHAR

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_json_auto

Description

DuckDB function read_json_auto().

Usage

read_json_auto(
  col0,
  convert_strings_to_integers,
  maximum_sample_files,
  timestamp_format,
  field_appearance_threshold,
  timestampformat,
  map_inference_threshold,
  date_format,
  filename,
  union_by_name,
  compression,
  maximum_depth,
  columns,
  sample_size,
  hive_types,
  hive_types_autocast,
  maximum_object_size,
  format,
  ignore_errors,
  hive_partitioning,
  auto_detect,
  records,
  dateformat
)

Arguments

col0

VARCHAR | VARCHAR[]

convert_strings_to_integers

BOOLEAN

maximum_sample_files

BIGINT

timestamp_format

VARCHAR

field_appearance_threshold

DOUBLE

timestampformat

VARCHAR

map_inference_threshold

BIGINT

date_format

VARCHAR

filename

ANY

union_by_name

BOOLEAN

compression

VARCHAR

maximum_depth

BIGINT

columns

ANY

sample_size

BIGINT

hive_types

ANY

hive_types_autocast

BOOLEAN

maximum_object_size

UINTEGER

format

VARCHAR

ignore_errors

BOOLEAN

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

records

VARCHAR

dateformat

VARCHAR

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_json_objects

Description

DuckDB function read_json_objects().

Usage

read_json_objects(
  col0,
  ignore_errors,
  format,
  maximum_object_size,
  hive_types_autocast,
  hive_types,
  hive_partitioning,
  compression,
  union_by_name,
  filename
)

Arguments

col0

VARCHAR | VARCHAR[]

ignore_errors

BOOLEAN

format

VARCHAR

maximum_object_size

UINTEGER

hive_types_autocast

BOOLEAN

hive_types

ANY

hive_partitioning

BOOLEAN

compression

VARCHAR

union_by_name

BOOLEAN

filename

ANY

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_json_objects_auto

Description

DuckDB function read_json_objects_auto().

Usage

read_json_objects_auto(
  col0,
  ignore_errors,
  format,
  maximum_object_size,
  hive_types_autocast,
  hive_types,
  hive_partitioning,
  compression,
  union_by_name,
  filename
)

Arguments

col0

VARCHAR | VARCHAR[]

ignore_errors

BOOLEAN

format

VARCHAR

maximum_object_size

UINTEGER

hive_types_autocast

BOOLEAN

hive_types

ANY

hive_partitioning

BOOLEAN

compression

VARCHAR

union_by_name

BOOLEAN

filename

ANY

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_ndjson

Description

DuckDB function read_ndjson().

Usage

read_ndjson(
  col0,
  convert_strings_to_integers,
  maximum_sample_files,
  timestamp_format,
  field_appearance_threshold,
  timestampformat,
  map_inference_threshold,
  date_format,
  filename,
  union_by_name,
  compression,
  maximum_depth,
  columns,
  sample_size,
  hive_types,
  hive_types_autocast,
  maximum_object_size,
  format,
  ignore_errors,
  hive_partitioning,
  auto_detect,
  records,
  dateformat
)

Arguments

col0

VARCHAR | VARCHAR[]

convert_strings_to_integers

BOOLEAN

maximum_sample_files

BIGINT

timestamp_format

VARCHAR

field_appearance_threshold

DOUBLE

timestampformat

VARCHAR

map_inference_threshold

BIGINT

date_format

VARCHAR

filename

ANY

union_by_name

BOOLEAN

compression

VARCHAR

maximum_depth

BIGINT

columns

ANY

sample_size

BIGINT

hive_types

ANY

hive_types_autocast

BOOLEAN

maximum_object_size

UINTEGER

format

VARCHAR

ignore_errors

BOOLEAN

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

records

VARCHAR

dateformat

VARCHAR

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_ndjson_auto

Description

DuckDB function read_ndjson_auto().

Usage

read_ndjson_auto(
  col0,
  convert_strings_to_integers,
  maximum_sample_files,
  timestamp_format,
  field_appearance_threshold,
  timestampformat,
  map_inference_threshold,
  date_format,
  filename,
  union_by_name,
  compression,
  maximum_depth,
  columns,
  sample_size,
  hive_types,
  hive_types_autocast,
  maximum_object_size,
  format,
  ignore_errors,
  hive_partitioning,
  auto_detect,
  records,
  dateformat
)

Arguments

col0

VARCHAR | VARCHAR[]

convert_strings_to_integers

BOOLEAN

maximum_sample_files

BIGINT

timestamp_format

VARCHAR

field_appearance_threshold

DOUBLE

timestampformat

VARCHAR

map_inference_threshold

BIGINT

date_format

VARCHAR

filename

ANY

union_by_name

BOOLEAN

compression

VARCHAR

maximum_depth

BIGINT

columns

ANY

sample_size

BIGINT

hive_types

ANY

hive_types_autocast

BOOLEAN

maximum_object_size

UINTEGER

format

VARCHAR

ignore_errors

BOOLEAN

hive_partitioning

BOOLEAN

auto_detect

BOOLEAN

records

VARCHAR

dateformat

VARCHAR

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_ndjson_objects

Description

DuckDB function read_ndjson_objects().

Usage

read_ndjson_objects(
  col0,
  ignore_errors,
  format,
  maximum_object_size,
  hive_types_autocast,
  hive_types,
  hive_partitioning,
  compression,
  union_by_name,
  filename
)

Arguments

col0

VARCHAR | VARCHAR[]

ignore_errors

BOOLEAN

format

VARCHAR

maximum_object_size

UINTEGER

hive_types_autocast

BOOLEAN

hive_types

ANY

hive_partitioning

BOOLEAN

compression

VARCHAR

union_by_name

BOOLEAN

filename

ANY

Value

Unspecified.

Provided by

The json extension (LOAD json;).


DuckDB function read_parquet

Description

DuckDB function read_parquet().

Usage

read_parquet(
  col0,
  can_have_nan,
  filename,
  union_by_name,
  debug_use_openssl,
  hive_partitioning,
  parquet_version,
  encryption_config,
  hive_types_autocast,
  binary_as_string,
  explicit_cardinality,
  compression,
  file_row_number,
  hive_types,
  schema
)

Arguments

col0

VARCHAR | VARCHAR[]

can_have_nan

BOOLEAN

filename

ANY

union_by_name

BOOLEAN

debug_use_openssl

BOOLEAN

hive_partitioning

BOOLEAN

parquet_version

VARCHAR

encryption_config

ANY

hive_types_autocast

BOOLEAN

binary_as_string

BOOLEAN

explicit_cardinality

UBIGINT

compression

VARCHAR

file_row_number

BOOLEAN

hive_types

ANY

schema

ANY

Value

Unspecified.


DuckDB function read_postgres_binary

Description

DuckDB function read_postgres_binary().

Usage

read_postgres_binary(col0, buffer_size, columns)

Arguments

col0

VARCHAR

buffer_size

UBIGINT

columns

ANY

Value

Unspecified.

Provided by

The postgres_scanner extension (LOAD postgres_scanner;).


DuckDB function read_text

Description

DuckDB function read_text().

Usage

read_text(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.


DuckDB function read_vortex

Description

DuckDB function read_vortex().

Usage

read_vortex(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.

Provided by

The vortex extension (LOAD vortex;).


DuckDB function read_xlsx

Description

DuckDB function read_xlsx().

Usage

read_xlsx(
  col0,
  normalize_names,
  empty_as_varchar,
  stop_at_empty,
  sheet,
  range,
  ignore_errors,
  all_varchar,
  header
)

Arguments

col0

VARCHAR

normalize_names

BOOLEAN

empty_as_varchar

BOOLEAN

stop_at_empty

BOOLEAN

sheet

VARCHAR

range

VARCHAR

ignore_errors

BOOLEAN

all_varchar

BOOLEAN

header

BOOLEAN

Value

Unspecified.

Provided by

The excel extension (LOAD excel;).


DuckDB function regexp_escape

Description

Escapes special patterns to turn string into a regular expression similarly to Python's re.escape function.

Usage

regexp_escape(string)

Arguments

string

VARCHAR

Value

VARCHAR

SQL examples

regexp_escape('https://duckdb.org')

See Also

Other regex: regexp_extract(), regexp_extract_all(), regexp_full_match(), regexp_matches(), regexp_replace(), string_split_regex()


DuckDB function regexp_extract

Description

  • regexp_extract(string = VARCHAR, regex = VARCHAR), regexp_extract(string = VARCHAR, regex = VARCHAR, group = INTEGER), regexp_extract(string = VARCHAR, regex = VARCHAR, group = INTEGER, options = VARCHAR): If string contains the regex pattern, returns the capturing group specified by optional parameter group; otherwise, returns the empty string. The group must be a constant value. If no group is given, it defaults to 0. A set of optional regex options can be set.

  • regexp_extract(string = VARCHAR, regex = VARCHAR, name_list = `VARCHAR[]`), regexp_extract(string = VARCHAR, regex = VARCHAR, name_list = `VARCHAR[]`, options = VARCHAR): If string contains the regex pattern, returns the capturing groups as a struct with corresponding names from name_list; otherwise, returns a struct with the same keys and empty strings as values. A set of optional regex options can be set.

Usage

regexp_extract(string, regex, group, options)

Arguments

string

VARCHAR

regex

VARCHAR

group

INTEGER

options

VARCHAR

Value

VARCHAR

Overloads

  • regexp_extract(string = VARCHAR, regex = VARCHAR)

  • regexp_extract(string = VARCHAR, regex = VARCHAR, group = INTEGER)

  • regexp_extract(string = VARCHAR, regex = VARCHAR, group = INTEGER, options = VARCHAR)

  • regexp_extract(string = VARCHAR, regex = VARCHAR, name_list = `VARCHAR[]`)

  • regexp_extract(string = VARCHAR, regex = VARCHAR, name_list = `VARCHAR[]`, options = VARCHAR)

SQL examples

regexp_extract('abcde', '[a-z]{3}')
regexp_extract('abc', '([a-z])(b)', 1)
regexp_extract('ABC', '([a-z])(b)', 1, 'i')
regexp_extract('2023-04-15', '(\d+)-(\d+)-(\d+)', ['y', 'm', 'd'])
regexp_extract('John Doe', '([a-z]+) ([a-z]+)', ['first_name', 'last_name'], 'i')

See Also

Other regex: regexp_escape(), regexp_extract_all(), regexp_full_match(), regexp_matches(), regexp_replace(), string_split_regex()


DuckDB function regexp_extract_all

Description

Finds non-overlapping occurrences of the regex in the string and returns the corresponding values of the capturing group. A set of optional regex options can be set.

Usage

regexp_extract_all(string, regex, group, options)

Arguments

string

VARCHAR

regex

VARCHAR

group

INTEGER | VARCHAR[]

options

VARCHAR

Value

VARCHAR[]

Overloads

  • regexp_extract_all(string = VARCHAR, regex = VARCHAR)

  • regexp_extract_all(string = VARCHAR, regex = VARCHAR, group = INTEGER)

  • regexp_extract_all(string = VARCHAR, regex = VARCHAR, group = INTEGER, options = VARCHAR)

  • regexp_extract_all(string = VARCHAR, regex = VARCHAR, group = `VARCHAR[]`)

  • regexp_extract_all(string = VARCHAR, regex = VARCHAR, group = `VARCHAR[]`, options = VARCHAR)

SQL examples

regexp_extract_all('Peter: 33, Paul:14', '(\w+):\s*(\d+)', 2)

See Also

Other regex: regexp_escape(), regexp_extract(), regexp_full_match(), regexp_matches(), regexp_replace(), string_split_regex()


DuckDB function regexp_full_match

Description

Returns true if the entire string matches the regex. A set of optional regex options can be set.

Usage

regexp_full_match(string, regex, col2)

Arguments

string, regex, col2

VARCHAR

Value

BOOLEAN

Overloads

  • regexp_full_match(string = VARCHAR, regex = VARCHAR)

  • regexp_full_match(string = VARCHAR, regex = VARCHAR, col2 = VARCHAR)

SQL examples

regexp_full_match('anabanana', '(an)*')

See Also

Other regex: regexp_escape(), regexp_extract(), regexp_extract_all(), regexp_matches(), regexp_replace(), string_split_regex()


DuckDB function regexp_matches

Description

Returns true if string contains the regex, false otherwise. A set of optional regex options can be set.

Usage

regexp_matches(string, regex, options)

Arguments

string, regex, options

VARCHAR

Value

BOOLEAN

Overloads

  • regexp_matches(string = VARCHAR, regex = VARCHAR)

  • regexp_matches(string = VARCHAR, regex = VARCHAR, options = VARCHAR)

SQL examples

regexp_matches('anabanana', '(an)*')

See Also

Other regex: regexp_escape(), regexp_extract(), regexp_extract_all(), regexp_full_match(), regexp_replace(), string_split_regex()


DuckDB function regexp_replace

Description

If string contains the regex, replaces the matching part with replacement. A set of optional regex options can be set.

Usage

regexp_replace(string, regex, replacement, options)

Arguments

string, regex, replacement, options

VARCHAR

Value

VARCHAR

Overloads

  • regexp_replace(string = VARCHAR, regex = VARCHAR, replacement = VARCHAR)

  • regexp_replace(string = VARCHAR, regex = VARCHAR, replacement = VARCHAR, options = VARCHAR)

SQL examples

regexp_replace('hello', '[lo]', '-')

See Also

Other regex: regexp_escape(), regexp_extract(), regexp_extract_all(), regexp_full_match(), regexp_matches(), string_split_regex()


DuckDB function regexp_split_to_table

Description

DuckDB macro regexp_split_to_table().

Usage

regexp_split_to_table(text, pattern)

Arguments

text, pattern

Unspecified.

Value

Unspecified.


DuckDB function regr_avgx

Description

Returns the average of the independent variable for non-NULL pairs in a group, where x is the independent variable and y is the dependent variable.

Usage

regr_avgx(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE


DuckDB function regr_avgy

Description

Returns the average of the dependent variable for non-NULL pairs in a group, where x is the independent variable and y is the dependent variable.

Usage

regr_avgy(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE


DuckDB function regr_count

Description

Returns the number of non-NULL number pairs in a group.

Usage

regr_count(y, x)

Arguments

y, x

DOUBLE

Value

UINTEGER

SQL examples

(SUM(x*y) - SUM(x) * SUM(y) / COUNT(*)) / COUNT(*)

DuckDB function regr_intercept

Description

Returns the intercept of the univariate linear regression line for non-NULL pairs in a group.

Usage

regr_intercept(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

AVG(y)-REGR_SLOPE(y, x)*AVG(x)

DuckDB function regr_r2

Description

Returns the coefficient of determination for non-NULL pairs in a group.

Usage

regr_r2(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE


DuckDB function regr_slope

Description

Returns the slope of the linear regression line for non-NULL pairs in a group.

Usage

regr_slope(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

COVAR_POP(x, y) / VAR_POP(x)

DuckDB function regr_sxx

Description

DuckDB function regr_sxx().

Usage

regr_sxx(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

REGR_COUNT(y, x) * VAR_POP(x)

DuckDB function regr_sxy

Description

Returns the population covariance of input values.

Usage

regr_sxy(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

REGR_COUNT(y, x) * COVAR_POP(y, x)

DuckDB function regr_syy

Description

DuckDB function regr_syy().

Usage

regr_syy(y, x)

Arguments

y, x

DOUBLE

Value

DOUBLE

SQL examples

REGR_COUNT(y, x) * VAR_POP(y)

DuckDB function remap_struct

Description

Map a struct to another struct type, potentially re-ordering, renaming and casting members and filling in defaults for missing values.

Usage

remap_struct(input, target_type, mapping, defaults)

Arguments

input, target_type, mapping, defaults

ANY

Value

ANY

SQL examples

remap_struct({'i': 1, 'j': 2}, NULL::ROW(v1 INT, v2 INT, v3 INT), {'v1': 'j', 'v3': 'i'}, {'v2': NULL::INTEGER})

DuckDB function remove_iceberg_schema_properties

Description

DuckDB function remove_iceberg_schema_properties().

Usage

remove_iceberg_schema_properties(col0, col1)

Arguments

col0

VARCHAR

col1

VARCHAR[]

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function remove_iceberg_table_properties

Description

DuckDB function remove_iceberg_table_properties().

Usage

remove_iceberg_table_properties(col0, col1)

Arguments

col0

VARCHAR

col1

VARCHAR[]

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function repeat

Description

  • `repeat`(string = VARCHAR, count = BIGINT): Repeats the string count number of times.

  • `repeat`(blob = BLOB, count = BIGINT): Repeats the blob count number of times.

  • `repeat`(list = `T[]`, count = BIGINT): Repeats the list count number of times.

  • `repeat`(col0 = ANY, col1 = BIGINT): (Description missing.)

Usage

`repeat`(string, count)

Arguments

string

VARCHAR

count

BIGINT

Value

VARCHAR | BLOB | T[]

Overloads

  • `repeat`(col0 = ANY, col1 = BIGINT)

  • `repeat`(string = VARCHAR, count = BIGINT)

  • `repeat`(blob = BLOB, count = BIGINT)

  • `repeat`(list = `T[]`, count = BIGINT)

SQL examples

repeat('A', 5)
repeat('\xAA\xBB'::BLOB, 5)
repeat([1, 2, 3], 5)

See Also

Other blob: decode(), encode(), from_base64(), hex(), md5(), md5_number(), octet_length(), or–or, sha1(), sha256(), to_base64(), unbin(), unhex()

Other list: array_extract(), array_length(), concat(), contains(), flatten(), generate_series(), len(), list_aggregate(), list_concat(), list_contains(), list_cosine_distance(), list_cosine_similarity(), list_distance(), list_distinct(), list_extract(), list_filter(), list_grade_up(), list_has_all(), list_has_any(), list_inner_product(), list_intersect(), list_negative_inner_product(), list_position(), list_reduce(), list_resize(), list_reverse_sort(), list_select(), list_slice(), list_sort(), list_transform(), list_unique(), list_value(), list_where(), list_zip(), or–or, range(), unpivot_list()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function repeat_row

Description

DuckDB function repeat_row().

Usage

repeat_row(num_rows)

Arguments

num_rows

BIGINT

Value

Unspecified.


DuckDB function replace_type

Description

Casts all fields of type1 to type2.

Usage

replace_type(param, type1, type2)

Arguments

param, type1, type2

ANY

Value

ANY

SQL examples

replace_type({duck: 3.141592653589793::DOUBLE}, NULL::DOUBLE, NULL::DECIMAL(15,2))

DuckDB function reservoir_quantile

Description

Gives the approximate quantile using reservoir sampling, the sample size is optional and uses 8192 as a default size.

Usage

reservoir_quantile(x, quantile, sample_size)

Arguments

x

DECIMAL | TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE

quantile

DOUBLE | DOUBLE[]

sample_size

INTEGER

Value

DECIMAL | DECIMAL[] | TINYINT | TINYINT[] | SMALLINT | SMALLINT[] | INTEGER | INTEGER[] | BIGINT | BIGINT[] | HUGEINT | HUGEINT[] | FLOAT | FLOAT[] | DOUBLE | DOUBLE[]

Overloads

  • reservoir_quantile(x = DECIMAL, quantile = DOUBLE)

  • reservoir_quantile(x = DECIMAL, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = DECIMAL, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = DECIMAL, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = TINYINT, quantile = DOUBLE)

  • reservoir_quantile(x = TINYINT, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = TINYINT, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = TINYINT, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = SMALLINT, quantile = DOUBLE)

  • reservoir_quantile(x = SMALLINT, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = SMALLINT, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = SMALLINT, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = INTEGER, quantile = DOUBLE)

  • reservoir_quantile(x = INTEGER, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = INTEGER, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = INTEGER, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = BIGINT, quantile = DOUBLE)

  • reservoir_quantile(x = BIGINT, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = BIGINT, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = BIGINT, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = HUGEINT, quantile = DOUBLE)

  • reservoir_quantile(x = HUGEINT, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = HUGEINT, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = HUGEINT, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = FLOAT, quantile = DOUBLE)

  • reservoir_quantile(x = FLOAT, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = FLOAT, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = FLOAT, quantile = `DOUBLE[]`, sample_size = INTEGER)

  • reservoir_quantile(x = DOUBLE, quantile = DOUBLE)

  • reservoir_quantile(x = DOUBLE, quantile = DOUBLE, sample_size = INTEGER)

  • reservoir_quantile(x = DOUBLE, quantile = `DOUBLE[]`)

  • reservoir_quantile(x = DOUBLE, quantile = `DOUBLE[]`, sample_size = INTEGER)

SQL examples

reservoir_quantile(A, 0.5, 1024)

DuckDB function round

Description

Rounds x to s decimal places.

Usage

round(x, precision)

Arguments

x

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL

precision

INTEGER

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL

Overloads

  • round(x = TINYINT)

  • round(x = TINYINT, precision = INTEGER)

  • round(x = SMALLINT)

  • round(x = SMALLINT, precision = INTEGER)

  • round(x = INTEGER)

  • round(x = INTEGER, precision = INTEGER)

  • round(x = BIGINT)

  • round(x = BIGINT, precision = INTEGER)

  • round(x = HUGEINT)

  • round(x = HUGEINT, precision = INTEGER)

  • round(x = FLOAT)

  • round(x = FLOAT, precision = INTEGER)

  • round(x = DOUBLE)

  • round(x = DOUBLE, precision = INTEGER)

  • round(x = DECIMAL)

  • round(x = DECIMAL, precision = INTEGER)

SQL examples

round(42.4332, 2)

DuckDB function round_even

Description

DuckDB macro round_even().

Usage

round_even(x, n)

Arguments

x, n

Unspecified.

Value

Unspecified.


DuckDB function roundbankers

Description

DuckDB macro roundbankers().

Usage

roundbankers(x, n)

Arguments

x, n

Unspecified.

Value

Unspecified.


DuckDB function row

Description

Create an unnamed STRUCT (tuple) containing the argument values.

Usage

row()

Value

STRUCT

SQL examples

row(i, i % 4, i / 4)

DuckDB function row_number

Description

DuckDB function row_number().

Usage

row_number()

Value

BIGINT


DuckDB function row_to_json

Description

DuckDB function row_to_json().

Usage

row_to_json()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function rpad

Description

Pads the string with the character on the right until it has count characters. Truncates the string on the right if it has more than count characters.

Usage

rpad(string, count, character)

Arguments

string

VARCHAR

count

INTEGER

character

VARCHAR

Value

VARCHAR

SQL examples

rpad('hello', 10, '<')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function rtree_index_dump

Description

DuckDB function rtree_index_dump().

Usage

rtree_index_dump(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function rtree_index_scan

Description

DuckDB function rtree_index_scan().

Usage

rtree_index_scan()

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function rtrim

Description

Removes any occurrences of any of the characters from the right side of the string. characters defaults to space.

Usage

rtrim(string, characters)

Arguments

string, characters

VARCHAR

Value

VARCHAR

Overloads

  • rtrim(string = VARCHAR)

  • rtrim(string = VARCHAR, characters = VARCHAR)

SQL examples

rtrim('    test  ')
rtrim('>>>>test<<', '><')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function second

Description

Extract the second component from a date or timestamp.

Usage

second(ts)

Arguments

ts

⁠DATE | INTERVAL | TIME | TIMESTAMP | TIME WITH TIME ZONE | TIME_NS | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

second(timestamp '2021-08-03 11:59:44.123456')

DuckDB function sem

Description

Returns the standard error of the mean.

Usage

sem(x)

Arguments

x

DOUBLE

Value

DOUBLE


DuckDB function seq_scan

Description

DuckDB function seq_scan().

Usage

seq_scan()

Value

Unspecified.


DuckDB function session_user

Description

DuckDB macro session_user().

Usage

session_user()

Value

Unspecified.


DuckDB function set_bit

Description

Sets the nth bit in bitstring to newvalue; the first (leftmost) bit is indexed 0. Returns a new bitstring.

Usage

set_bit(bitstring, index, new_value)

Arguments

bitstring

BIT

index

INTEGER

new_value

INTEGER

Value

BIT

SQL examples

set_bit('0110010'::BIT, 2, 0)

DuckDB function set_iceberg_schema_properties

Description

DuckDB function set_iceberg_schema_properties().

Usage

set_iceberg_schema_properties(col0, col1)

Arguments

col0

VARCHAR

col1

ANY

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function set_iceberg_table_properties

Description

DuckDB function set_iceberg_table_properties().

Usage

set_iceberg_table_properties(col0, col1)

Arguments

col0

VARCHAR

col1

ANY

Value

Unspecified.

Provided by

The iceberg extension (LOAD iceberg;).


DuckDB function setseed

Description

Sets the seed to be used for the random function.

Usage

setseed(col0)

Arguments

col0

DOUBLE

Value

"NULL"

SQL examples

setseed(0.42)

DuckDB function shapefile_meta

Description

DuckDB function shapefile_meta().

Usage

shapefile_meta(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function shobj_description

Description

DuckDB macro shobj_description().

Usage

shobj_description(object_oid, catalog_name)

Arguments

object_oid, catalog_name

Unspecified.

Value

Unspecified.


DuckDB function show

Description

DuckDB function show().

Usage

show(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function show_databases

Description

DuckDB function show_databases().

Usage

show_databases()

Value

Unspecified.


DuckDB function show_tables

Description

DuckDB function show_tables().

Usage

show_tables()

Value

Unspecified.


DuckDB function show_tables_expanded

Description

DuckDB function show_tables_expanded().

Usage

show_tables_expanded()

Value

Unspecified.


DuckDB function sign

Description

Returns the sign of x as -1, 0 or 1.

Usage

sign(x)

Arguments

x

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Value

TINYINT

SQL examples

sign(-349)

DuckDB function signbit

Description

Returns whether the signbit is set or not.

Usage

signbit(x)

Arguments

x

FLOAT | DOUBLE

Value

BOOLEAN

SQL examples

signbit(-0.0)

DuckDB function sin

Description

Computes the sin of x.

Usage

sin(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

sin(90)

DuckDB function sinh

Description

Computes the hyperbolic sin of x.

Usage

sinh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

sinh(1)

DuckDB function skewness

Description

Returns the skewness of all input values.

Usage

skewness(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

skewness(A)

DuckDB function sleep_ms

Description

Sleeps for the specified number of milliseconds and returns NULL.

Usage

sleep_ms(milliseconds)

Arguments

milliseconds

BIGINT

Value

"NULL"

SQL examples

sleep_ms(100)

DuckDB function sniff_csv

Description

DuckDB function sniff_csv().

Usage

sniff_csv(
  col0,
  force_match,
  hive_types,
  union_by_name,
  hive_partitioning,
  filename,
  thousands,
  strict_mode,
  hive_types_autocast,
  encoding,
  dtypes,
  column_types,
  auto_detect,
  sample_size,
  files_to_sniff,
  dateformat,
  columns,
  all_varchar,
  new_line,
  header,
  types,
  skip,
  compression,
  comment,
  quote,
  max_line_size,
  store_rejects,
  delim,
  sep,
  column_names,
  buffer_size,
  timestampformat,
  normalize_names,
  ignore_errors,
  names,
  allow_quoted_nulls,
  maximum_line_size,
  rejects_table,
  force_not_null,
  parallel,
  auto_type_candidates,
  rejects_scan,
  rejects_limit,
  nullstr,
  escape,
  decimal_separator,
  null_padding
)

Arguments

col0

VARCHAR

force_match

BOOLEAN

hive_types

ANY

union_by_name

BOOLEAN

hive_partitioning

BOOLEAN

filename

ANY

thousands

VARCHAR

strict_mode

BOOLEAN

hive_types_autocast

BOOLEAN

encoding

VARCHAR

dtypes

ANY

column_types

ANY

auto_detect

BOOLEAN

sample_size

BIGINT

files_to_sniff

BIGINT

dateformat

VARCHAR

columns

ANY

all_varchar

BOOLEAN

new_line

VARCHAR

header

BOOLEAN

types

ANY

skip

BIGINT

compression

VARCHAR

comment

VARCHAR

quote

VARCHAR

max_line_size

VARCHAR

store_rejects

BOOLEAN

delim

VARCHAR

sep

VARCHAR

column_names

VARCHAR[]

buffer_size

UBIGINT

timestampformat

VARCHAR

normalize_names

BOOLEAN

ignore_errors

BOOLEAN

names

VARCHAR[]

allow_quoted_nulls

BOOLEAN

maximum_line_size

VARCHAR

rejects_table

VARCHAR

force_not_null

VARCHAR[]

parallel

BOOLEAN

auto_type_candidates

ANY

rejects_scan

VARCHAR

rejects_limit

BIGINT

nullstr

ANY

escape

VARCHAR

decimal_separator

VARCHAR

null_padding

BOOLEAN

Value

Unspecified.


DuckDB function split_part

Description

DuckDB macro split_part().

Usage

split_part(string, delimiter, position)

Arguments

string, delimiter, position

Unspecified.

Value

Unspecified.


DuckDB function sql_auto_complete

Description

DuckDB function sql_auto_complete().

Usage

sql_auto_complete(
  col0,
  max_exact_suggestion_count,
  max_file_suggestion_count,
  max_suggestion_count
)

Arguments

col0

VARCHAR

max_exact_suggestion_count

UBIGINT

max_file_suggestion_count

UBIGINT

max_suggestion_count

UBIGINT

Value

Unspecified.

Provided by

The autocomplete extension (LOAD autocomplete;).


DuckDB function sqlite_attach

Description

DuckDB function sqlite_attach().

Usage

sqlite_attach(col0, overwrite)

Arguments

col0

VARCHAR

overwrite

BOOLEAN

Value

Unspecified.

Provided by

The sqlite_scanner extension (LOAD sqlite_scanner;).


DuckDB function sqlite_query

Description

DuckDB function sqlite_query().

Usage

sqlite_query(col0, col1, params)

Arguments

col0

VARCHAR

col1

VARCHAR

params

ANY

Value

Unspecified.

Provided by

The sqlite_scanner extension (LOAD sqlite_scanner;).


DuckDB function sqlite_scan

Description

DuckDB function sqlite_scan().

Usage

sqlite_scan(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.

Provided by

The sqlite_scanner extension (LOAD sqlite_scanner;).


DuckDB function sqrt

Description

Returns the square root of x.

Usage

sqrt(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

sqrt(4)

DuckDB function ST_Affine

Description

Applies an affine transformation to a geometry.

For the 2D variant, the transformation matrix is defined as follows:

| a b xoff |
| d e yoff |
| 0 0 1    |

For the 3D variant, the transformation matrix is defined as follows:

| a b c xoff |
| d e f yoff |
| g h i zoff |
| 0 0 0 1    |

The transformation is applied to all vertices of the geometry.

Usage

ST_Affine(geom, a, b, c, d, e, f, g, h, i, xoff, yoff, zoff)

Arguments

geom

GEOMETRY

a

DOUBLE

b

DOUBLE

c

DOUBLE

d

DOUBLE

e

DOUBLE

f

DOUBLE

g

DOUBLE

h

DOUBLE

i

DOUBLE

xoff

DOUBLE

yoff

DOUBLE

zoff

DOUBLE

Value

GEOMETRY

Overloads

  • ST_Affine(geom = GEOMETRY, a = DOUBLE, b = DOUBLE, c = DOUBLE, d = DOUBLE, e = DOUBLE, f = DOUBLE, g = DOUBLE, h = DOUBLE, i = DOUBLE, xoff = DOUBLE, yoff = DOUBLE, zoff = DOUBLE)

  • ST_Affine(geom = GEOMETRY, a = DOUBLE, b = DOUBLE, d = DOUBLE, e = DOUBLE, xoff = DOUBLE, yoff = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Translate a point by (2, 3)
SELECT ST_Affine(ST_Point(1, 1),
                 1, 0,   -- a, b
                 0, 1,   -- d, e
                 2, 3);  -- xoff, yoff
-- POINT (3 4)
-- 
-- -- Scale a geometry by factor 2 in X and Y
-- SELECT ST_Affine(ST_Point(1, 1),
--                  2, 0, 0,   -- a, b, c
--                  0, 2, 0,   -- d, e, f
--                  0, 0, 1,   -- g, h, i
--                  0, 0, 0);  -- xoff, yoff, zoff
-- POINT (2 2)

DuckDB function ST_Area

Description

Compute the area of a geometry.

Returns 0.0 for any geometry that is not a POLYGON, MULTIPOLYGON or GEOMETRYCOLLECTION containing polygon geometries.

The area is in the same units as the spatial reference system of the geometry.

The POINT_2D and LINESTRING_2D overloads of this function always return 0.0 but are included for completeness.

Usage

ST_Area(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Area(geom = GEOMETRY)

  • ST_Area(polygon = POLYGON_2D)

  • ST_Area(linestring = LINESTRING_2D)

  • ST_Area(point = POINT_2D)

  • ST_Area(box = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Area('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
-- 1.0

DuckDB function ST_Area_Spheroid

Description

Returns the area of a geometry in meters, using an ellipsoidal model of the earth

The input geometry is assumed to be in the EPSG:4326 coordinate system (WGS84), with [latitude, longitude] axis order and the area is returned in square meters. This function uses the GeographicLib library, calculating the area using an ellipsoidal model of the earth. This is a highly accurate method for calculating the area of a polygon taking the curvature of the earth into account, but is also the slowest.

Returns 0.0 for any geometry that is not a POLYGON, MULTIPOLYGON or GEOMETRYCOLLECTION containing polygon geometries.

Usage

ST_Area_Spheroid(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Area_Spheroid(geom = GEOMETRY)

  • ST_Area_Spheroid(poly = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_AsGeoJSON

Description

Returns the geometry as a GeoJSON fragment

This does not return a complete GeoJSON document, only the geometry fragment. To construct a complete GeoJSON document or feature, look into using the DuckDB JSON extension in conjunction with this function. This function supports geometries with Z values, but not M values. M values are ignored.

Usage

ST_AsGeoJSON(geom)

Arguments

geom

GEOMETRY

Value

JSON

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsGeoJSON('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
-- {"type":"Polygon","coordinates":[[[0.0, 0.0], [0.0, 1.0], [1.0, 1.0], [1.0, 0.0], [0.0, 0.0]]]}
-- 
-- -- Convert a geometry into a full GeoJSON feature (requires the JSON extension to be loaded)
-- SELECT CAST({
--     type: 'Feature',
--     geometry: ST_AsGeoJSON(ST_Point(1, 2)),
--     properties: {
--         name: 'my_point'
--     }
-- } AS JSON);
-- {"type":"Feature","geometry":{"type":"Point","coordinates":[1.0, 2.0]},"properties":{"name":"my_point"}}

DuckDB function ST_AsHEXWKB

Description

Returns the geometry as a HEXWKB string.

Usage

ST_AsHEXWKB(geom)

Arguments

geom

GEOMETRY

Value

VARCHAR

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsHexWKB('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
-- 01030000000100000005000000000000000000000000000...

DuckDB function ST_AsMVT

Description

Make a Mapbox Vector Tile from a set of geometries and properties The function takes as input a row type (STRUCT) containing a geometry column and any number of property columns. It returns a single binary BLOB containing the Mapbox Vector Tile.

The function has the following signature:

⁠ST_AsMVT(row STRUCT, layer_name VARCHAR DEFAULT 'layer', extent INTEGER DEFAULT 4096, geom_column_name VARCHAR DEFAULT NULL, feature_id_column_name VARCHAR DEFAULT NULL) -> BLOB⁠

  • The first argument is a struct containing the geometry and properties.

  • The second argument is the name of the layer in the vector tile. This argument is optional and defaults to 'layer'.

  • The third argument is the extent of the tile. This argument is optional and defaults to 4096.

  • The fourth argument is the name of the geometry column in the input row. This argument is optional. If not provided, the first geometry column in the input row will be used. If multiple geometry columns are present, an error will be raised.

  • The fifth argument is the name of the feature id column in the input row. This argument is optional. If provided, the values in this column will be used as feature ids in the vector tile. The column must be of type INTEGER or BIGINT. If set to negative or NULL, a feature id will not be assigned to the corresponding feature.

The input struct must contain exactly one geometry column of type GEOMETRY. It can contain any number of property columns of types VARCHAR, FLOAT, DOUBLE, INTEGER, BIGINT, or BOOLEAN.

Example:

SELECT ST_AsMVT({'geom': geom, 'id': id, 'name': name}, 'cities', 4096, 'geom', 'id') AS tile
FROM cities;

This example creates a vector tile named 'cities' with an extent of 4096 from the 'cities' table, using 'geom' as the geometry column and 'id' as the feature id column.

However, you probably want to use the ST_AsMVTGeom function to first transform and clip your geometries to the tile extent. The following example assumes the geometry is in WebMercator ("EPSG:3857") coordinates. Replace {z}, {x}, and {y} with the appropriate tile coordinates, ⁠{your table}⁠ with your table name, and {tile_path} with the path to write the tile to.

COPY (
    SELECT ST_AsMVT({{
        "geometry": ST_AsMVTGeom(
            geometry,
            ST_Extent(ST_TileEnvelope({z}, {x}, {y})),
            4096,
            256,
            false
        )
    }})
    FROM {your table} WHERE ST_Intersects(geometry, ST_TileEnvelope({z}, {x}, {y}))
) to {tile_path} (FORMAT 'BLOB');
```.

Usage

ST_AsMVT(col0, col1, col2, col3, col4)

Arguments

col0

ANY

col1

VARCHAR

col2

INTEGER

col3

VARCHAR

col4

VARCHAR

Value

BLOB

Overloads

  • ST_AsMVT(col0 = ANY)

  • ST_AsMVT(col0 = ANY, col1 = VARCHAR)

  • ST_AsMVT(col0 = ANY, col1 = VARCHAR, col2 = INTEGER)

  • ST_AsMVT(col0 = ANY, col1 = VARCHAR, col2 = INTEGER, col3 = VARCHAR)

  • ST_AsMVT(col0 = ANY, col1 = VARCHAR, col2 = INTEGER, col3 = VARCHAR, col4 = VARCHAR)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_AsMVTGeom

Description

Transform and clip geometry to a tile boundary

See "ST_AsMVT" for more details.

Usage

ST_AsMVTGeom(geom, bounds, extent, buffer, clip_geom)

Arguments

geom

GEOMETRY

bounds

BOX_2D

extent

BIGINT

buffer

BIGINT

clip_geom

BOOLEAN

Value

GEOMETRY

Overloads

  • ST_AsMVTGeom(geom = GEOMETRY, bounds = BOX_2D, extent = BIGINT, buffer = BIGINT, clip_geom = BOOLEAN)

  • ST_AsMVTGeom(geom = GEOMETRY, bounds = BOX_2D, extent = BIGINT, buffer = BIGINT)

  • ST_AsMVTGeom(geom = GEOMETRY, bounds = BOX_2D, extent = BIGINT)

  • ST_AsMVTGeom(geom = GEOMETRY, bounds = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_AsSVG

Description

Convert the geometry into a SVG fragment or path

The SVG fragment is returned as a string. The fragment is a path element that can be used in an SVG document. The second boolean argument specifies whether the path should be relative or absolute. The third argument specifies the maximum number of digits to use for the coordinates.

Points are formatted as cx/cy using absolute coordinates or x/y using relative coordinates.

Usage

ST_AsSVG(geom, relative, precision)

Arguments

geom

GEOMETRY

relative

BOOLEAN

precision

INTEGER

Value

VARCHAR

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsSVG('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY, false, 15);
-- M 0 0 L 0 -1 1 -1 1 0 Z

DuckDB function st_astext

Description

  • st_astext(geom = GEOMETRY): Returns the Well-Known Text (WKT) representation of the geometry.

  • st_astext(point = POINT_2D), st_astext(linestring = LINESTRING_2D), st_astext(polygon = POLYGON_2D), st_astext(box = BOX_2D): Returns the geometry as a WKT string.

Usage

st_astext(geom)

Arguments

geom

GEOMETRY

Value

VARCHAR

Overloads

  • st_astext(geom = GEOMETRY)

  • st_astext(point = POINT_2D)

  • st_astext(linestring = LINESTRING_2D)

  • st_astext(polygon = POLYGON_2D)

  • st_astext(box = BOX_2D)

Provided by

  • st_astext(geom = GEOMETRY): built in

  • st_astext(point = POINT_2D): spatial

  • st_astext(linestring = LINESTRING_2D): spatial

  • st_astext(polygon = POLYGON_2D): spatial

  • st_astext(box = BOX_2D): spatial

SQL examples

ST_AsText(ST_GeomFromWKB(X'01010000000000000000000000000000000000000000000000'))
SELECT ST_MakeEnvelope(0, 0, 1, 1);
-- POLYGON ((0 0, 0 1, 1 1, 1 0, 0 0))

See Also

Other geometry: st_aswkb(), st_crs(), st_geomfromwkb()


DuckDB function st_aswkb

Description

Returns the Well-Known Binary (WKB) representation of the geometry.

Usage

st_aswkb(geom)

Arguments

geom

GEOMETRY

Value

BLOB

SQL examples

st_aswkb(ST_GeomFromWKB(X'01010000000000000000000000000000000000000000000000000'))

See Also

Other geometry: st_astext(), st_crs(), st_geomfromwkb()


DuckDB function ST_Azimuth

Description

Returns the azimuth (a clockwise angle measured from north) of two points in radian.

Usage

ST_Azimuth(origin, target)

Arguments

origin, target

GEOMETRY | POINT_2D

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT degrees(ST_Azimuth(ST_Point(0, 0), ST_Point(0, 1)));
-- 90.0

DuckDB function ST_Boundary

Description

Returns the "boundary" of a geometry.

Usage

ST_Boundary(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Buffer

Description

Returns a buffer around the input geometry at the target distance

geom is the input geometry.

distance is the target distance for the buffer, using the same units as the input geometry.

num_triangles represents how many triangles that will be produced to approximate a quarter circle. The larger the number, the smoother the resulting geometry. The default value is 8.

cap_style must be one of "CAP_ROUND", "CAP_FLAT", "CAP_SQUARE". This parameter is case-insensitive.

join_style must be one of "JOIN_ROUND", "JOIN_MITRE", "JOIN_BEVEL". This parameter is case-insensitive.

mitre_limit only applies when join_style is "JOIN_MITRE". It is the ratio of the distance from the corner to the mitre point to the corner radius. The default value is 1.0.

This is a planar operation and will not take into account the curvature of the earth.

Usage

ST_Buffer(geom, distance, num_triangles, cap_style, join_style, mitre_limit)

Arguments

geom

GEOMETRY

distance

DOUBLE

num_triangles

INTEGER

cap_style

VARCHAR

join_style

VARCHAR

mitre_limit

DOUBLE

Value

GEOMETRY

Overloads

  • ST_Buffer(geom = GEOMETRY, distance = DOUBLE)

  • ST_Buffer(geom = GEOMETRY, distance = DOUBLE, num_triangles = INTEGER)

  • ST_Buffer(geom = GEOMETRY, distance = DOUBLE, num_triangles = INTEGER, cap_style = VARCHAR, join_style = VARCHAR, mitre_limit = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_BuildArea

Description

Creates a polygonal geometry by attempting to "fill in" the input geometry.

Unlike ST_Polygonize, this function does not fill in holes.

Usage

ST_BuildArea(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Centroid

Description

Returns the centroid of a geometry.

Usage

ST_Centroid(box)

Arguments

box

BOX_2D | BOX_2DF

Value

GEOMETRY | POINT_2D

Overloads

  • ST_Centroid(geom = GEOMETRY)

  • ST_Centroid(point = POINT_2D)

  • ST_Centroid(linestring = LINESTRING_2D)

  • ST_Centroid(polygon = POLYGON_2D)

  • ST_Centroid(box = BOX_2D)

  • ST_Centroid(box = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_ClosestPoint

Description

Returns the closest point on the first geometry to the second geometry.

Usage

ST_ClosestPoint(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Collect

Description

Collects a list of geometries into a collection geometry.

  • If all geometries are POINT's, a MULTIPOINT is returned.

  • If all geometries are LINESTRING's, a MULTILINESTRING is returned.

  • If all geometries are POLYGON's, a MULTIPOLYGON is returned.

  • Otherwise if the input collection contains a mix of geometry types, a GEOMETRYCOLLECTION is returned.

Empty and NULL geometries are ignored. If all geometries are empty or NULL, a ⁠GEOMETRYCOLLECTION EMPTY⁠ is returned.

Usage

ST_Collect(geoms)

Arguments

geoms

GEOMETRY[]

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- With all POINT's, a MULTIPOINT is returned
SELECT ST_Collect([ST_Point(1, 2), ST_Point(3, 4)]);
-- MULTIPOINT (1 2, 3 4)
-- 
-- -- With mixed geometry types, a GEOMETRYCOLLECTION is returned
-- SELECT ST_Collect([ST_Point(1, 2), ST_GeomFromText('LINESTRING(3 4, 5 6)')]);
-- GEOMETRYCOLLECTION (POINT (1 2), LINESTRING (3 4, 5 6))
-- 
-- -- Note that the empty geometry is ignored, so the result is a MULTIPOINT
-- SELECT ST_Collect([ST_Point(1, 2), NULL, ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')]);
-- MULTIPOINT (1 2)
-- 
-- -- If all geometries are empty or NULL, a GEOMETRYCOLLECTION EMPTY is returned
-- SELECT ST_Collect([NULL, ST_GeomFromText('GEOMETRYCOLLECTION EMPTY')]);
-- GEOMETRYCOLLECTION EMPTY
-- 
-- -- Tip: You can use the `ST_Collect` function together with the `list()` aggregate function to collect multiple rows of geometries into a single geometry collection:
-- 
-- CREATE TABLE points (geom GEOMETRY);
-- 
-- INSERT INTO points VALUES (ST_Point(1, 2)), (ST_Point(3, 4));
-- 
-- SELECT ST_Collect(list(geom)) FROM points;
-- MULTIPOINT (1 2, 3 4)

DuckDB function ST_CollectionExtract

Description

Extracts geometries from a GeometryCollection into a typed multi geometry.

If the input geometry is a GeometryCollection, the function will return a multi geometry, determined by the type parameter.

  • if type = 1, returns a MultiPoint containing all the Points in the collection

  • if type = 2, returns a MultiLineString containing all the LineStrings in the collection

  • if type = 3, returns a MultiPolygon containing all the Polygons in the collection

If no type parameters is provided, the function will return a multi geometry matching the highest "surface dimension" of the contained geometries. E.g. if the collection contains only Points, a MultiPoint will be returned. But if the collection contains both Points and LineStrings, a MultiLineString will be returned. Similarly, if the collection contains Polygons, a MultiPolygon will be returned. Contained geometries of a lower surface dimension will be ignored.

If the input geometry contains nested GeometryCollections, their geometries will be extracted recursively and included into the final multi geometry as well.

If the input geometry is not a GeometryCollection, the function will return the input geometry as is.

Usage

ST_CollectionExtract(geom, type)

Arguments

geom

GEOMETRY

type

INTEGER

Value

GEOMETRY

Overloads

  • ST_CollectionExtract(geom = GEOMETRY, type = INTEGER)

  • ST_CollectionExtract(geom = GEOMETRY)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_CollectionExtract('MULTIPOINT(1 2, 3 4)'::GEOMETRY, 1);
-- MULTIPOINT (1 2, 3 4)

DuckDB function ST_ConcaveHull

Description

Returns the 'concave' hull of the input geometry, containing all of the source input's points, and which can be used to create polygons from points. The ratio parameter dictates the level of concavity; 1.0 returns the convex hull; and 0 indicates to return the most concave hull possible. Set allowHoles to a non-zero value to allow output containing holes.

Usage

ST_ConcaveHull(geom, ratio, allowHoles)

Arguments

geom

GEOMETRY

ratio

DOUBLE

allowHoles

BOOLEAN

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Contains

Description

Returns true if the first geometry contains the second geometry

In contrast to ST_ContainsProperly, this function will also return true if geom2 is contained strictly on the boundary of geom1. A geometry always ST_Contains itself, but does not ST_ContainsProperly itself.

Usage

ST_Contains(geom1, geom2)

Arguments

geom1

POLYGON_2D | GEOMETRY

geom2

POINT_2D | GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_ContainsProperly

Description

Returns true if the first geometry \"properly\" contains the second geometry

In contrast to ST_Contains, this function does not return true if geom2 is contained strictly on the boundary of geom1. A geometry always ST_Contains itself, but does not ST_ContainsProperly itself.

Usage

ST_ContainsProperly(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_ConvexHull

Description

Returns the convex hull enclosing the geometry.

Usage

ST_ConvexHull(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageClean

Description

Aligns the edges of a list of polygons whose edges are meant to align but are in fact exact matches.

Returns a collection of fixed polygons with the same size and order as the input polygons. EMPTY will be used in place of collapsed polygons.

Usage

ST_CoverageClean(geoms, snapping_distance, gap_maximum_width)

Arguments

geoms

GEOMETRY[]

snapping_distance

DOUBLE

gap_maximum_width

DOUBLE

Value

GEOMETRY

Overloads

  • ST_CoverageClean(geoms = `GEOMETRY[]`, snapping_distance = DOUBLE, gap_maximum_width = DOUBLE)

  • ST_CoverageClean(geoms = `GEOMETRY[]`, snapping_distance = DOUBLE)

  • ST_CoverageClean(geoms = `GEOMETRY[]`)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageInvalidEdges

Description

Returns the invalid edges in a polygonal coverage, which are edges that are not shared by two polygons. Returns NULL if the input is not a polygonal coverage, or if the input is valid. Tolerance is 0 by default.

Usage

ST_CoverageInvalidEdges(geoms, tolerance)

Arguments

geoms

GEOMETRY[]

tolerance

DOUBLE

Value

GEOMETRY

Overloads

  • ST_CoverageInvalidEdges(geoms = `GEOMETRY[]`, tolerance = DOUBLE)

  • ST_CoverageInvalidEdges(geoms = `GEOMETRY[]`)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageInvalidEdges_Agg

Description

Returns the invalid edges of a coverage geometry.

Usage

ST_CoverageInvalidEdges_Agg(col0, col1)

Arguments

col0

GEOMETRY

col1

DOUBLE

Value

GEOMETRY

Overloads

  • ST_CoverageInvalidEdges_Agg(col0 = GEOMETRY)

  • ST_CoverageInvalidEdges_Agg(col0 = GEOMETRY, col1 = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageSimplify

Description

Simplify the edges in a polygonal coverage, preserving the coverange by ensuring that the there are no seams between the resulting simplified polygons.

By default, the boundary of the coverage is also simplified, but this can be controlled with the optional third 'simplify_boundary' parameter.

Usage

ST_CoverageSimplify(geoms, tolerance, simplify_boundary)

Arguments

geoms

GEOMETRY[]

tolerance

DOUBLE

simplify_boundary

BOOLEAN

Value

GEOMETRY

Overloads

  • ST_CoverageSimplify(geoms = `GEOMETRY[]`, tolerance = DOUBLE, simplify_boundary = BOOLEAN)

  • ST_CoverageSimplify(geoms = `GEOMETRY[]`, tolerance = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageSimplify_Agg

Description

Simplifies a set of geometries while maintaining coverage.

Usage

ST_CoverageSimplify_Agg(col0, col1, col2)

Arguments

col0

GEOMETRY

col1

DOUBLE

col2

BOOLEAN

Value

GEOMETRY

Overloads

  • ST_CoverageSimplify_Agg(col0 = GEOMETRY, col1 = DOUBLE)

  • ST_CoverageSimplify_Agg(col0 = GEOMETRY, col1 = DOUBLE, col2 = BOOLEAN)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageUnion

Description

Union all geometries in a polygonal coverage into a single geometry. This may be faster than using ST_Union, but may use more memory.

Usage

ST_CoverageUnion(geoms)

Arguments

geoms

GEOMETRY[]

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoverageUnion_Agg

Description

Unions a set of geometries while maintaining coverage.

Usage

ST_CoverageUnion_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_CoveredBy

Description

Returns true if geom1 is "covered by" geom2.

Usage

ST_CoveredBy(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Covers

Description

Returns true if the geom1 "covers" geom2.

Usage

ST_Covers(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Crosses

Description

Returns true if geom1 "crosses" geom2.

Usage

ST_Crosses(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function st_crs

Description

Returns the Coordinate Reference System (CRS) identifier of the geometry.

Usage

st_crs(geom)

Arguments

geom

GEOMETRY

Value

VARCHAR

See Also

Other geometry: st_astext(), st_aswkb(), st_geomfromwkb()


DuckDB function ST_Difference

Description

Returns the "difference" between two geometries.

Usage

ST_Difference(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Dimension

Description

Returns the "topological dimension" of a geometry.

  • For POINT and MULTIPOINT geometries, returns 0

  • For LINESTRING and MULTILINESTRING, returns 1

  • For POLYGON and MULTIPOLYGON, returns 2

  • For GEOMETRYCOLLECTION, returns the maximum dimension of the contained geometries, or 0 if the collection is empty.

Usage

ST_Dimension(geom)

Arguments

geom

GEOMETRY

Value

INTEGER

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Dimension('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'::GEOMETRY);
-- 2

DuckDB function ST_Disjoint

Description

Returns true if the geometries are disjoint.

Usage

ST_Disjoint(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Distance

Description

Returns the planar distance between two geometries.

Usage

ST_Distance(point1, point2)

Arguments

point1, point2

POINT_2D

Value

DOUBLE

Overloads

  • ST_Distance(point1 = POINT_2D, point2 = POINT_2D)

  • ST_Distance(point = POINT_2D, linestring = LINESTRING_2D)

  • ST_Distance(linestring = LINESTRING_2D, point = POINT_2D)

  • ST_Distance(geom1 = GEOMETRY, geom2 = GEOMETRY)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Distance('POINT (0 0)'::GEOMETRY, 'POINT (3 4)'::GEOMETRY);
-- 5.0
-- 
-- -- Z coordinates are ignored
-- SELECT ST_Distance('POINT Z (0 0 0)'::GEOMETRY, 'POINT Z (3 4 5)'::GEOMETRY);
-- 5.0

DuckDB function ST_Distance_GEOS

Description

Returns the planar distance between two geometries.

Usage

ST_Distance_GEOS(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Distance_Sphere

Description

Returns the haversine (great circle) distance between two geometries.

  • Only supports POINT geometries.

  • Returns the distance in meters.

  • The input is expected to be in WGS84 (EPSG:4326) coordinates, using a [latitude, longitude] axis order.

Usage

ST_Distance_Sphere(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Distance_Sphere(geom1 = GEOMETRY, geom2 = GEOMETRY)

  • ST_Distance_Sphere(point1 = POINT_2D, point2 = POINT_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Distance_Spheroid

Description

Returns the distance between two geometries in meters using an ellipsoidal model of the earths surface

The input geometry is assumed to be in the EPSG:4326 coordinate system (WGS84), with [latitude, longitude] axis order and the distance limit is expected to be in meters. This function uses the GeographicLib library to solve the inverse geodesic problem, calculating the distance between two points using an ellipsoidal model of the earth. This is a highly accurate method for calculating the distance between two arbitrary points taking the curvature of the earths surface into account, but is also the slowest.

Usage

ST_Distance_Spheroid(p1, p2)

Arguments

p1, p2

POINT_2D

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Note: the coordinates are in WGS84 and [latitude, longitude] axis order
-- Whats the distance between New York and Amsterdam (JFK and AMS airport)?
SELECT st_distance_spheroid(
st_point(40.6446, -73.7797),
st_point(52.3130, 4.7725)
);
-- 5863418.7459356235
-- -- Roughly 5863km!

DuckDB function ST_Drivers

Description

Returns the list of supported GDAL drivers and file formats

Note that far from all of these drivers have been tested properly. Some may require additional options to be passed to work as expected. If you run into any issues please first consult the consult the GDAL docs.

Usage

ST_Drivers()

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT * FROM ST_Drivers();

DuckDB function ST_Dump

Description

Dumps a geometry into a list of sub-geometries and their "path" in the original geometry.

You can use the unnest(res, recursive := true) function to explode the resulting list of structs into multiple rows.

Usage

ST_Dump(geom)

Arguments

geom

GEOMETRY

Value

⁠STRUCT(geom GEOMETRY, path INTEGER[])[]⁠

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Dump('MULTIPOINT(1 2, 3 4)'::GEOMETRY);
-- [{'geom': 'POINT(1 2)', 'path': [0]}, {'geom': 'POINT(3 4)', 'path': [1]}]
-- 
-- SELECT unnest(ST_Dump('MULTIPOINT(1 2, 3 4)'::GEOMETRY), recursive := true);
-- -- +-------------+---------+
-- -- |    geom     |  path   |
-- -- |  geometry   | int32[] |
-- -- +-------------+---------+
-- -- | POINT (1 2) | [1]     |
-- -- | POINT (3 4) | [2]     |
-- -- +-------------+---------+

DuckDB function ST_DWithin

Description

Returns if two geometries are within a target distance of each-other.

Usage

ST_DWithin(geom1, geom2, distance)

Arguments

geom1

GEOMETRY

geom2

GEOMETRY

distance

DOUBLE

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_DWithin_GEOS

Description

Returns true if two geometries are within a target distance of each-other.

Usage

ST_DWithin_GEOS(geom1, geom2, distance)

Arguments

geom1

GEOMETRY

geom2

GEOMETRY

distance

DOUBLE

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_DWithin_Spheroid

Description

Returns if two POINT_2D's are within a target distance in meters, using an ellipsoidal model of the earths surface

The input geometry is assumed to be in the EPSG:4326 coordinate system (WGS84), with [latitude, longitude] axis order and the distance is returned in meters. This function uses the GeographicLib library to solve the inverse geodesic problem, calculating the distance between two points using an ellipsoidal model of the earth. This is a highly accurate method for calculating the distance between two arbitrary points taking the curvature of the earths surface into account, but is also the slowest.

Usage

ST_DWithin_Spheroid(p1, p2, distance)

Arguments

p1

POINT_2D

p2

POINT_2D

distance

DOUBLE

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_EndPoint

Description

Returns the end point of a LINESTRING.

Usage

ST_EndPoint(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY | POINT_2D

Overloads

  • ST_EndPoint(geom = GEOMETRY)

  • ST_EndPoint(line = LINESTRING_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Envelope

Description

Returns the minimum bounding rectangle of a geometry as a polygon geometry.

Usage

ST_Envelope(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Envelope_Agg

Description

Alias for ST_Extent_Agg.

Computes the minimal-bounding-box polygon containing the set of input geometries.

Usage

ST_Envelope_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Extent_Agg(geom) FROM UNNEST([ST_Point(1,1), ST_Point(5,5)]) AS _(geom);
-- POLYGON ((1 1, 1 5, 5 5, 5 1, 1 1))

DuckDB function ST_Equals

Description

Returns true if the geometries are "equal".

Usage

ST_Equals(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Expand

Description

Expand the input geometry by the specified distance, returning a polygon.

geom is the input geometry.

distance is the target distance for the expansion, using the same units as the input geometry.

This is a planar operation and will not take into account the curvature of the earth.

Usage

ST_Expand(geom, distance)

Arguments

geom

GEOMETRY

distance

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsText(ST_Expand(ST_GeomFromText('POINT(20 30)'), 0.1));

DuckDB function ST_Extent

Description

Returns the minimal bounding box enclosing the input geometry.

Usage

ST_Extent(geom)

Arguments

geom

GEOMETRY

Value

BOX_2D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Extent_Agg

Description

Computes the minimal-bounding-box polygon containing the set of input geometries.

Usage

ST_Extent_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Extent_Agg(geom) FROM UNNEST([ST_Point(1,1), ST_Point(5,5)]) AS _(geom);
-- POLYGON ((1 1, 1 5, 5 5, 5 1, 1 1))

DuckDB function ST_Extent_Approx

Description

Returns the approximate bounding box of a geometry, if available.

This function is only really used internally, and returns the cached bounding box of the geometry if it exists. This function may be removed or renamed in the future.

Usage

ST_Extent_Approx(geom)

Arguments

geom

GEOMETRY

Value

BOX_2DF

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_ExteriorRing

Description

Returns the exterior ring (shell) of a polygon geometry.

Usage

ST_ExteriorRing(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY | LINESTRING_2D

Overloads

  • ST_ExteriorRing(geom = GEOMETRY)

  • ST_ExteriorRing(polygon = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_FlipCoordinates

Description

Returns a new geometry with the coordinates of the input geometry "flipped" so that x = y and y = x.

Usage

ST_FlipCoordinates(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY | POINT_2D | LINESTRING_2D | POLYGON_2D | BOX_2D

Overloads

  • ST_FlipCoordinates(geom = GEOMETRY)

  • ST_FlipCoordinates(point = POINT_2D)

  • ST_FlipCoordinates(linestring = LINESTRING_2D)

  • ST_FlipCoordinates(polygon = POLYGON_2D)

  • ST_FlipCoordinates(box = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Force2D

Description

Forces the vertices of a geometry to have X and Y components

This function will drop any Z and M values from the input geometry, if present. If the input geometry is already 2D, it will be returned as is.

Usage

ST_Force2D(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Force3DM

Description

Forces the vertices of a geometry to have X, Y and M components

The following cases apply:

  • If the input geometry has a Z component but no M component, the Z component will be replaced with the new M value.

  • If the input geometry has a M component but no Z component, it will be returned as is.

  • If the input geometry has both a Z component and a M component, the Z component will be removed.

  • Otherwise, if the input geometry has neither a Z or M component, the new M value will be added to the vertices of the input geometry.

Usage

ST_Force3DM(geom, m)

Arguments

geom

GEOMETRY

m

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Force3DZ

Description

Forces the vertices of a geometry to have X, Y and Z components

The following cases apply:

  • If the input geometry has a M component but no Z component, the M component will be replaced with the new Z value.

  • If the input geometry has a Z component but no M component, it will be returned as is.

  • If the input geometry has both a Z component and a M component, the M component will be removed.

  • Otherwise, if the input geometry has neither a Z or M component, the new Z value will be added to the vertices of the input geometry.

Usage

ST_Force3DZ(geom, z)

Arguments

geom

GEOMETRY

z

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Force4D

Description

Forces the vertices of a geometry to have X, Y, Z and M components

The following cases apply:

  • If the input geometry has a Z component but no M component, the new M value will be added to the vertices of the input geometry.

  • If the input geometry has a M component but no Z component, the new Z value will be added to the vertices of the input geometry.

  • If the input geometry has both a Z component and a M component, the geometry will be returned as is.

  • Otherwise, if the input geometry has neither a Z or M component, the new Z and M values will be added to the vertices of the input geometry.

Usage

ST_Force4D(geom, z, m)

Arguments

geom

GEOMETRY

z

DOUBLE

m

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_GeneratePoints

Description

Generates a set of random points within the specified bounding box.

Takes a bounding box (min_x, min_y, max_x, max_y), a count of points to generate, and optionally a seed for the random number generator.

Usage

ST_GeneratePoints(col0, col1, col2)

Arguments

col0

BOX_2D

col1

BIGINT

col2

BIGINT

Value

Unspecified.

Overloads

  • ST_GeneratePoints(col0 = BOX_2D, col1 = BIGINT)

  • ST_GeneratePoints(col0 = BOX_2D, col1 = BIGINT, col2 = BIGINT)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT * FROM ST_GeneratePoints({min_x: 0, min_y:0, max_x:10, max_y:10}::BOX_2D, 5, 42);

DuckDB function ST_GeometryType

Description

Returns a 'GEOMETRY_TYPE' enum identifying the input geometry type. Possible enum return types are: POINT, LINESTRING, POLYGON, MULTIPOINT, MULTILINESTRING, MULTIPOLYGON, and GEOMETRYCOLLECTION.

Usage

ST_GeometryType(geom)

Arguments

geom

GEOMETRY

Value

ANY

Overloads

  • ST_GeometryType(geom = GEOMETRY)

  • ST_GeometryType(point = POINT_2D)

  • ST_GeometryType(linestring = LINESTRING_2D)

  • ST_GeometryType(polygon = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT DISTINCT ST_GeometryType(ST_GeomFromText('POINT(1 1)'));
-- POINT

DuckDB function ST_GeomFromGeoJSON

Description

Deserializes a GEOMETRY from a GeoJSON fragment.

Usage

ST_GeomFromGeoJSON(geojson)

Arguments

geojson

JSON | VARCHAR

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_GeomFromGeoJSON('{"type": "Point", "coordinates": [1.0, 2.0]}');
-- POINT (1 2)

DuckDB function ST_GeomFromHEXEWKB

Description

Deserialize a GEOMETRY from a HEX(E)WKB encoded string

DuckDB spatial doesn't currently differentiate between WKB and EWKB, so ST_GeomFromHEXWKB and ST_GeomFromHEXEWKB are just aliases of each other.

Usage

ST_GeomFromHEXEWKB(hexwkb)

Arguments

hexwkb

VARCHAR

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_GeomFromHEXWKB

Description

Deserialize a GEOMETRY from a HEX(E)WKB encoded string

DuckDB spatial doesn't currently differentiate between WKB and EWKB, so ST_GeomFromHEXWKB and ST_GeomFromHEXEWKB are just aliases of each other.

Usage

ST_GeomFromHEXWKB(hexwkb)

Arguments

hexwkb

VARCHAR

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_GeomFromText

Description

Deserialize a GEOMETRY from a WKT encoded string.

Usage

ST_GeomFromText(wkt, ignore_invalid)

Arguments

wkt

VARCHAR

ignore_invalid

BOOLEAN

Value

GEOMETRY

Overloads

  • ST_GeomFromText(wkt = VARCHAR)

  • ST_GeomFromText(wkt = VARCHAR, ignore_invalid = BOOLEAN)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function st_geomfromwkb

Description

Creates a geometry from Well-Known Binary (WKB) representation.

Usage

st_geomfromwkb(wkb)

Arguments

wkb

BLOB

Value

GEOMETRY

SQL examples

ST_GeomFromWKB(X'01010000000000000000000000000000000000000000000000')

See Also

Other geometry: st_astext(), st_aswkb(), st_crs()


DuckDB function ST_HasM

Description

Check if the input geometry has M values.

Usage

ST_HasM(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- HasM for a 2D geometry
SELECT ST_HasM(ST_GeomFromText('POINT(1 1)'));
-- false
-- 
-- -- HasM for a 3DZ geometry
-- SELECT ST_HasM(ST_GeomFromText('POINT Z(1 1 1)'));
-- false
-- 
-- -- HasM for a 3DM geometry
-- SELECT ST_HasM(ST_GeomFromText('POINT M(1 1 1)'));
-- true
-- 
-- -- HasM for a 4D geometry
-- SELECT ST_HasM(ST_GeomFromText('POINT ZM(1 1 1 1)'));
-- true

DuckDB function ST_HasZ

Description

Check if the input geometry has Z values.

Usage

ST_HasZ(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- HasZ for a 2D geometry
SELECT ST_HasZ(ST_GeomFromText('POINT(1 1)'));
-- false
-- 
-- -- HasZ for a 3DZ geometry
-- SELECT ST_HasZ(ST_GeomFromText('POINT Z(1 1 1)'));
-- true
-- 
-- -- HasZ for a 3DM geometry
-- SELECT ST_HasZ(ST_GeomFromText('POINT M(1 1 1)'));
-- false
-- 
-- -- HasZ for a 4D geometry
-- SELECT ST_HasZ(ST_GeomFromText('POINT ZM(1 1 1 1)'));
-- true

DuckDB function ST_Hilbert

Description

Encodes the X and Y values as the hilbert curve index for a curve covering the given bounding box. If a geometry is provided, the center of the approximate bounding box is used as the point to encode. If no bounding box is provided, the hilbert curve index is mapped to the full range of a single-precision float. For the BOX_2D and BOX_2DF variants, the center of the box is used as the point to encode.

Usage

ST_Hilbert(box, bounds)

Arguments

box, bounds

BOX_2D | BOX_2DF

Value

UINTEGER

Overloads

  • ST_Hilbert(x = DOUBLE, y = DOUBLE, bounds = BOX_2D)

  • ST_Hilbert(geom = GEOMETRY, bounds = BOX_2D)

  • ST_Hilbert(geom = GEOMETRY)

  • ST_Hilbert(box = BOX_2D, bounds = BOX_2D)

  • ST_Hilbert(box = BOX_2DF, bounds = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_InteriorRingN

Description

Returns the N-th interior ring (hole) of a POLYGON as a LINESTRING. Indexing is 1-based (n = 1 returns the first interior ring). Returns NULL if the polygon is empty or has fewer than N interior rings.

Usage

ST_InteriorRingN(geom, n)

Arguments

geom

GEOMETRY

n

BIGINT

Value

GEOMETRY | LINESTRING_2D

Overloads

  • ST_InteriorRingN(geom = GEOMETRY, n = BIGINT)

  • ST_InteriorRingN(polygon = POLYGON_2D, n = BIGINT)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsText(ST_InteriorRingN(ST_GeomFromText('POLYGON((0 0,10 0,10 10,0 10,0 0),(2 2,4 2,4 4,2 4,2 2))'), 1));

DuckDB function ST_InterpolatePoint

Description

Computes the closest point on a LINESTRING to a given POINT and returns the interpolated M value of that point.

First argument must be a linestring and must have a M dimension. The second argument must be a point. Neither argument can be empty.

Usage

ST_InterpolatePoint(line, point)

Arguments

line, point

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Intersection

Description

Returns the intersection of two geometries.

Usage

ST_Intersection(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Intersection_Agg

Description

Computes the intersection of a set of geometries.

Usage

ST_Intersection_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Intersects

Description

Returns true if the geometries intersect.

Usage

ST_Intersects(box1, box2)

Arguments

box1, box2

BOX_2D

Value

BOOLEAN

Overloads

  • ST_Intersects(box1 = BOX_2D, box2 = BOX_2D)

  • ST_Intersects(geom1 = GEOMETRY, geom2 = GEOMETRY)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_IsClosed

Description

Check if a geometry is 'closed'.

Usage

ST_IsClosed(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_IsEmpty

Description

Returns true if the geometry is "empty".

Usage

ST_IsEmpty(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Overloads

  • ST_IsEmpty(geom = GEOMETRY)

  • ST_IsEmpty(linestring = LINESTRING_2D)

  • ST_IsEmpty(polygon = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_IsRing

Description

Returns true if the geometry is a ring (both ST_IsClosed and ST_IsSimple).

Usage

ST_IsRing(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_IsSimple

Description

Returns true if the geometry is simple.

Usage

ST_IsSimple(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_IsValid

Description

Returns true if the geometry is valid.

Usage

ST_IsValid(geom)

Arguments

geom

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Length

Description

Returns the length of the input line geometry.

Usage

ST_Length(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Length(geom = GEOMETRY)

  • ST_Length(linestring = LINESTRING_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Length_Spheroid

Description

Returns the length of the input geometry in meters, using an ellipsoidal model of the earth

The input geometry is assumed to be in the EPSG:4326 coordinate system (WGS84), with [latitude, longitude] axis order and the length is returned in meters. This function uses the GeographicLib library, calculating the length using an ellipsoidal model of the earth. This is a highly accurate method for calculating the length of a line geometry taking the curvature of the earth into account, but is also the slowest.

Returns 0.0 for any geometry that is not a LINESTRING, MULTILINESTRING or GEOMETRYCOLLECTION containing line geometries.

Usage

ST_Length_Spheroid(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Length_Spheroid(geom = GEOMETRY)

  • ST_Length_Spheroid(line = LINESTRING_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineInterpolatePoint

Description

Returns a point interpolated along a line at a fraction of total 2D length.

Usage

ST_LineInterpolatePoint(line, fraction)

Arguments

line

GEOMETRY

fraction

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineInterpolatePoints

Description

Returns a multi-point interpolated along a line at a fraction of total 2D length.

if repeat is false, the result is a single point, (and equivalent to ST_LineInterpolatePoint), otherwise, the result is a multi-point with points repeated at the fraction interval.

Usage

ST_LineInterpolatePoints(line, fraction, repeat.)

Arguments

line

GEOMETRY

fraction

DOUBLE

repeat.

BOOLEAN

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineLocatePoint

Description

Returns the location on a line closest to a point as a fraction of the total 2D length of the line.

Usage

ST_LineLocatePoint(line, point)

Arguments

line, point

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineMerge

Description

"Merges" the input line geometry, optionally taking direction into account.

Usage

ST_LineMerge(geom, preserve_direction)

Arguments

geom

GEOMETRY

preserve_direction

BOOLEAN

Value

GEOMETRY

Overloads

  • ST_LineMerge(geom = GEOMETRY)

  • ST_LineMerge(geom = GEOMETRY, preserve_direction = BOOLEAN)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineString2DFromWKB

Description

Deserialize a LINESTRING_2D from a WKB encoded blob.

Usage

ST_LineString2DFromWKB(blob)

Arguments

blob

BLOB

Value

LINESTRING_2D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LineSubstring

Description

Returns a substring of a line between two fractions of total 2D length.

Usage

ST_LineSubstring(line, start_fraction, end_fraction)

Arguments

line

GEOMETRY

start_fraction

DOUBLE

end_fraction

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LocateAlong

Description

Returns a point or multi-point, containing the point(s) at the geometry with the given measure

For a LINESTRING, or MULTILINESTRING, the location is determined by interpolating between M values For a POINT and MULTIPOINT, the point is returned if the measure matches the M value of the vertex, otherwise an empty geometry is returned For a POLYGON, only the exterior ring is considered, and treated as a LINESTRING

If offset is provided, the resulting point(s) is offset by the given amount perpendicular to the line direction.

Usage

ST_LocateAlong(line, measure, offset)

Arguments

line

GEOMETRY

measure

DOUBLE

offset

DOUBLE

Value

GEOMETRY

Overloads

  • ST_LocateAlong(line = GEOMETRY, measure = DOUBLE, offset = DOUBLE)

  • ST_LocateAlong(line = GEOMETRY, measure = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_LocateBetween

Description

Returns a geometry or geometry collection created by filtering and interpolating vertices within a range of "M" values

Creates a geometry or geometry collection, containing the parts formed by vertices that have an "M" value within the "start_measure" and "end_measure" range

For LINESTRING or MULTILINESTRING, if a line segment would cross either the upper or lower bound, a vertex is added by interpolating the coordinates at the "intersection" For a POINT and MULTIPOINT, the point is added to the collection if its vertex has an "M" value within the range, otherwise it is skipped For a POLYGON, only the exterior ring is considered, and treated like a LINESTRING

If offset is provided, the resulting vertices are offset by the given amount perpendicular to the line direction.

Usage

ST_LocateBetween(line, start_measure, end_measure, offset)

Arguments

line

GEOMETRY

start_measure

DOUBLE

end_measure

DOUBLE

offset

DOUBLE

Value

GEOMETRY

Overloads

  • ST_LocateBetween(line = GEOMETRY, start_measure = DOUBLE, end_measure = DOUBLE, offset = DOUBLE)

  • ST_LocateBetween(line = GEOMETRY, start_measure = DOUBLE, end_measure = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_M

Description

Returns the M coordinate of a point geometry.

Usage

ST_M(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_M(ST_Point(1, 2, 3, 4))

DuckDB function ST_MakeBox2D

Description

Create a BOX2D from two POINT geometries.

Usage

ST_MakeBox2D(point1, point2)

Arguments

point1, point2

GEOMETRY

Value

BOX_2D

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_MakeBox2D(ST_Point(0, 0), ST_Point(1, 1));
-- BOX(0 0, 1 1)

DuckDB function ST_MakeEnvelope

Description

Create a rectangular polygon from min/max coordinates.

Usage

ST_MakeEnvelope(min_x, min_y, max_x, max_y)

Arguments

min_x, min_y, max_x, max_y

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_MakeLine

Description

  • ST_MakeLine(geoms = `GEOMETRY[]`): Create a LINESTRING from a list of POINT geometries.

  • ST_MakeLine(start = GEOMETRY, end = GEOMETRY): Create a LINESTRING from two POINT geometries.

Usage

ST_MakeLine(start, end)

Arguments

start, end

GEOMETRY

Value

GEOMETRY

Overloads

  • ST_MakeLine(geoms = `GEOMETRY[]`)

  • ST_MakeLine(start = GEOMETRY, end = GEOMETRY)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_MakeLine([ST_Point(0, 0), ST_Point(1, 1)]);
-- LINESTRING(0 0, 1 1)
SELECT ST_MakeLine(ST_Point(0, 0), ST_Point(1, 1));
-- LINESTRING(0 0, 1 1)

DuckDB function ST_MakePoint

Description

  • ST_MakePoint(x = DOUBLE, y = DOUBLE): Creates a GEOMETRY point from an pair of floating point numbers.

    For geodetic coordinate systems, x is typically the longitude value and y is the latitude value.

    Note that ST_Point is equivalent. ST_MakePoint is provided for PostGIS compatibility.

  • ST_MakePoint(x = DOUBLE, y = DOUBLE, z = DOUBLE): Creates a POINT_3D.

  • ST_MakePoint(x = DOUBLE, y = DOUBLE, z = DOUBLE, m = DOUBLE): Creates a POINT_4D.

Usage

ST_MakePoint(x, y, z, m)

Arguments

x, y, z, m

DOUBLE

Value

POINT_2D | POINT_3D | POINT_4D

Overloads

  • ST_MakePoint(x = DOUBLE, y = DOUBLE)

  • ST_MakePoint(x = DOUBLE, y = DOUBLE, z = DOUBLE)

  • ST_MakePoint(x = DOUBLE, y = DOUBLE, z = DOUBLE, m = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_AsText(ST_MakePoint(143.3, -24.2));
-- POINT (143.3 -24.2)

DuckDB function ST_MakePolygon

Description

  • ST_MakePolygon(shell = GEOMETRY): Create a POLYGON from a LINESTRING shell.

  • ST_MakePolygon(shell = GEOMETRY, holes = `GEOMETRY[]`): Create a POLYGON from a LINESTRING shell and a list of LINESTRING holes.

Usage

ST_MakePolygon(shell, holes)

Arguments

shell

GEOMETRY

holes

GEOMETRY[]

Value

GEOMETRY

Overloads

  • ST_MakePolygon(shell = GEOMETRY)

  • ST_MakePolygon(shell = GEOMETRY, holes = `GEOMETRY[]`)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_MakePolygon(ST_LineString([ST_Point(0, 0), ST_Point(1, 0), ST_Point(1, 1), ST_Point(0, 0)]));
SELECT ST_MakePolygon(ST_LineString([ST_Point(0, 0), ST_Point(1, 0), ST_Point(1, 1), ST_Point(0, 0)]), [ST_LineString([ST_Point(0.25, 0.25), ST_Point(0.75, 0.25), ST_Point(0.75, 0.75), ST_Point(0.25, 0.25)])]);

DuckDB function ST_MakeValid

Description

Returns a valid representation of the geometry.

Usage

ST_MakeValid(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_MaximumInscribedCircle

Description

Returns the maximum inscribed circle of the input geometry, optionally with a tolerance.

By default, the tolerance is computed as max(width, height) / 1000. The return value is a struct with the center of the circle, the nearest point to the center on the boundary of the geometry, and the radius of the circle.

Usage

ST_MaximumInscribedCircle(geom, tolerance)

Arguments

geom

GEOMETRY

tolerance

DOUBLE

Value

⁠STRUCT(center GEOMETRY, nearest GEOMETRY, radius DOUBLE)⁠

Overloads

  • ST_MaximumInscribedCircle(geom = GEOMETRY)

  • ST_MaximumInscribedCircle(geom = GEOMETRY, tolerance = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Find the maximum inscribed circle of a square
SELECT ST_MaximumInscribedCircle(
    ST_GeomFromText('POLYGON((0 0, 10 0, 10 10, 0 10, 0 0))')
);
-- {'center': POINT (5 5), 'nearest': POINT (5 0), 'radius': 5.0}

DuckDB function ST_MemUnion_Agg

Description

Computes the union of a set of input geometries. "Slower, but might be more memory efficient than ST_UnionAgg as each geometry is merged into the union individually rather than all at once.

Usage

ST_MemUnion_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_MinimumRotatedRectangle

Description

Returns the minimum rotated rectangle that bounds the input geometry, finding the surrounding box that has the lowest area by using a rotated rectangle, rather than taking the lowest and highest coordinate values as per ST_Envelope().

Usage

ST_MinimumRotatedRectangle(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_MMax

Description

Returns the maximum M coordinate of a geometry.

Usage

ST_MMax(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_MMax(ST_Point(1, 2, 3, 4))

DuckDB function ST_MMin

Description

Returns the minimum M coordinate of a geometry.

Usage

ST_MMin(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_MMin(ST_Point(1, 2, 3, 4))

DuckDB function ST_Multi

Description

Turns a single geometry into a multi geometry.

If the geometry is already a multi geometry, it is returned as is.

Usage

ST_Multi(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Multi(ST_GeomFromText('POINT(1 2)'));
-- MULTIPOINT (1 2)
-- 
-- SELECT ST_Multi(ST_GeomFromText('LINESTRING(1 1, 2 2)'));
-- MULTILINESTRING ((1 1, 2 2))
-- 
-- SELECT ST_Multi(ST_GeomFromText('POLYGON((0 0, 0 1, 1 1, 1 0, 0 0))'));
-- MULTIPOLYGON (((0 0, 0 1, 1 1, 1 0, 0 0)))

DuckDB function ST_NGeometries

Description

Returns the number of component geometries in a collection geometry. If the input geometry is not a collection, this function returns 0 or 1 depending on if the geometry is empty or not.

Usage

ST_NGeometries(geom)

Arguments

geom

GEOMETRY

Value

INTEGER

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_NInteriorRings

Description

Returns the number of interior rings of a polygon.

Usage

ST_NInteriorRings(geom)

Arguments

geom

GEOMETRY

Value

INTEGER

Overloads

  • ST_NInteriorRings(geom = GEOMETRY)

  • ST_NInteriorRings(polygon = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Node

Description

Returns a "noded" MultiLinestring, produced by combining a collection of input linestrings and adding additional vertices where they intersect.

Usage

ST_Node(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Create a noded multilinestring from two intersecting lines
SELECT ST_Node(
    ST_GeomFromText('MULTILINESTRING((0 0, 2 2), (0 2, 2 0))')
);
-- MULTILINESTRING ((0 0, 1 1), (1 1, 2 2), (0 2, 1 1), (1 1, 2 0))

DuckDB function ST_Normalize

Description

Returns the "normalized" representation of the geometry.

Usage

ST_Normalize(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_NPoints

Description

Returns the number of vertices within a geometry.

Usage

ST_NPoints(geom)

Arguments

geom

GEOMETRY

Value

UINTEGER | UBIGINT

Overloads

  • ST_NPoints(geom = GEOMETRY)

  • ST_NPoints(point = POINT_2D)

  • ST_NPoints(linestring = LINESTRING_2D)

  • ST_NPoints(polygon = POLYGON_2D)

  • ST_NPoints(box = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_NumGeometries

Description

Returns the number of component geometries in a collection geometry. If the input geometry is not a collection, this function returns 0 or 1 depending on if the geometry is empty or not.

Usage

ST_NumGeometries(geom)

Arguments

geom

GEOMETRY

Value

INTEGER

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_NumInteriorRings

Description

Returns the number of interior rings of a polygon.

Usage

ST_NumInteriorRings(geom)

Arguments

geom

GEOMETRY

Value

INTEGER

Overloads

  • ST_NumInteriorRings(geom = GEOMETRY)

  • ST_NumInteriorRings(polygon = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_NumPoints

Description

Returns the number of vertices within a geometry.

Usage

ST_NumPoints(geom)

Arguments

geom

GEOMETRY

Value

UINTEGER | UBIGINT

Overloads

  • ST_NumPoints(geom = GEOMETRY)

  • ST_NumPoints(point = POINT_2D)

  • ST_NumPoints(linestring = LINESTRING_2D)

  • ST_NumPoints(polygon = POLYGON_2D)

  • ST_NumPoints(box = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Overlaps

Description

Returns true if the geometries overlap.

Usage

ST_Overlaps(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Perimeter

Description

Returns the length of the perimeter of the geometry.

Usage

ST_Perimeter(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Perimeter(geom = GEOMETRY)

  • ST_Perimeter(polygon = POLYGON_2D)

  • ST_Perimeter(box = BOX_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Perimeter_Spheroid

Description

Returns the length of the perimeter in meters using an ellipsoidal model of the earths surface

The input geometry is assumed to be in the EPSG:4326 coordinate system (WGS84), with [latitude, longitude] axis order and the length is returned in meters. This function uses the GeographicLib library, calculating the perimeter using an ellipsoidal model of the earth. This is a highly accurate method for calculating the perimeter of a polygon taking the curvature of the earth into account, but is also the slowest.

Returns 0.0 for any geometry that is not a POLYGON, MULTIPOLYGON or GEOMETRYCOLLECTION containing polygon geometries.

Usage

ST_Perimeter_Spheroid(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Perimeter_Spheroid(geom = GEOMETRY)

  • ST_Perimeter_Spheroid(poly = POLYGON_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Point

Description

Creates a GEOMETRY point.

Usage

ST_Point(x, y)

Arguments

x, y

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Point2D

Description

Creates a POINT_2D.

Usage

ST_Point2D(x, y)

Arguments

x, y

DOUBLE

Value

POINT_2D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Point2DFromWKB

Description

Deserialize a POINT_2D from a WKB encoded blob.

Usage

ST_Point2DFromWKB(blob)

Arguments

blob

BLOB

Value

POINT_2D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Point3D

Description

Creates a POINT_3D.

Usage

ST_Point3D(x, y, z)

Arguments

x, y, z

DOUBLE

Value

POINT_3D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Point4D

Description

Creates a POINT_4D.

Usage

ST_Point4D(x, y, z, m)

Arguments

x, y, z, m

DOUBLE

Value

POINT_4D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_PointN

Description

Returns the n'th vertex from the input geometry as a point geometry.

Usage

ST_PointN(geom, index)

Arguments

geom

GEOMETRY

index

INTEGER

Value

GEOMETRY | POINT_2D

Overloads

  • ST_PointN(geom = GEOMETRY, index = INTEGER)

  • ST_PointN(linestring = LINESTRING_2D, index = INTEGER)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_PointOnSurface

Description

Returns a point guaranteed to lie on the surface of the geometry.

Usage

ST_PointOnSurface(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Points

Description

Collects all the vertices in the geometry into a MULTIPOINT.

Usage

ST_Points(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Points('LINESTRING(1 1, 2 2)'::GEOMETRY);
-- MULTIPOINT (1 1, 2 2)
-- 
-- SELECT ST_Points('MULTIPOLYGON Z EMPTY'::GEOMETRY);
-- MULTIPOINT Z EMPTY

DuckDB function ST_Polygon2DFromWKB

Description

Deserialize a POLYGON_2D from a WKB encoded blob.

Usage

ST_Polygon2DFromWKB(blob)

Arguments

blob

BLOB

Value

POLYGON_2D

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Polygonize

Description

Returns a polygonized representation of the input geometries.

Usage

ST_Polygonize(geometries)

Arguments

geometries

GEOMETRY[]

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Create a polygon from a closed linestring ring
SELECT ST_Polygonize([
    ST_GeomFromText('LINESTRING(0 0, 0 10, 10 10, 10 0, 0 0)')
]);
---
GEOMETRYCOLLECTION (POLYGON ((0 0, 0 10, 10 10, 10 0, 0 0)))

DuckDB function ST_QuadKey

Description

Compute the quadkey for a given lon/lat point at a given level. Note that the parameter order is longitude, latitude.

level has to be between 1 and 23, inclusive.

The input coordinates will be clamped to the lon/lat bounds of the earth (longitude between -180 and 180, latitude between -85.05112878 and 85.05112878).

The geometry overload throws an error if the input geometry is not a POINT.

Usage

ST_QuadKey(longitude, latitude, level)

Arguments

longitude

DOUBLE

latitude

DOUBLE

level

INTEGER

Value

VARCHAR

Overloads

  • ST_QuadKey(longitude = DOUBLE, latitude = DOUBLE, level = INTEGER)

  • ST_QuadKey(point = GEOMETRY, level = INTEGER)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_QuadKey(ST_Point(11.08, 49.45), 10);
-- 1333203202

DuckDB function ST_Read

Description

Read and import a variety of geospatial file formats using the GDAL library.

The ST_Read table function is based on the GDAL translator library and enables reading spatial data from a variety of geospatial vector file formats as if they were DuckDB tables.

See ST_Drivers for a list of supported file formats and drivers.

Except for the path parameter, all parameters are optional.

Parameter Type Description
path VARCHAR The path to the file to read. Mandatory
sequential_layer_scan BOOLEAN If set to true, the table function will scan through all layers sequentially and return the first layer that matches the given layer name. This is required for some drivers to work properly, e.g., the OSM driver.
spatial_filter WKB_BLOB If set to a WKB blob, the table function will only return rows that intersect with the given WKB geometry. Some drivers may support efficient spatial filtering natively, in which case it will be pushed down. Otherwise the filtering is done by GDAL which may be much slower.
open_options VARCHAR[] A list of key-value pairs that are passed to the GDAL driver to control the opening of the file. E.g., the GeoJSON driver supports a FLATTEN_NESTED_ATTRIBUTES=YES option to flatten nested attributes.
layer VARCHAR The name of the layer to read from the file. If NULL, the first layer is returned. Can also be a layer index (starting at 0).
allowed_drivers VARCHAR[] A list of GDAL driver names that are allowed to be used to open the file. If empty, all drivers are allowed.
sibling_files VARCHAR[] A list of sibling files that are required to open the file. E.g., the ESRI Shapefile driver requires a .shx file to be present. Although most of the time these can be discovered automatically.
spatial_filter_box BOX_2D If set to a BOX_2D, the table function will only return rows that intersect with the given bounding box. Similar to spatial_filter.
keep_wkb BOOLEAN If set, the table function will return geometries in a wkb_geometry column with the type WKB_BLOB (which can be cast to BLOB) instead of GEOMETRY. This is useful if you want to use DuckDB with more exotic geometry subtypes that DuckDB spatial doesn't support representing in the GEOMETRY type yet.

Note that GDAL is single-threaded, so this table function will not be able to make full use of parallelism.

By using ST_Read, the spatial extension also provides “replacement scans” for common geospatial file formats, allowing you to query files of these formats as if they were tables directly.

SELECT * FROM './path/to/some/shapefile/dataset.shp';

In practice this is just syntax-sugar for calling ST_Read, so there is no difference in performance. If you want to pass additional options, you should use the ST_Read table function directly.

The following formats are currently recognized by their file extension:

Format Extension
ESRI ShapeFile .shp
GeoPackage .gpkg
FlatGeoBuf .fgb

Usage

ST_Read(
  col0,
  keep_wkb,
  max_batch_size,
  layer,
  sibling_files,
  allowed_drivers,
  open_options
)

Arguments

col0

VARCHAR

keep_wkb

BOOLEAN

max_batch_size

INTEGER

layer

VARCHAR

sibling_files

VARCHAR[]

allowed_drivers

VARCHAR[]

open_options

VARCHAR[]

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Read a Shapefile
SELECT * FROM ST_Read('some/file/path/filename.shp');

-- Read a GeoJSON file
CREATE TABLE my_geojson_table AS SELECT * FROM ST_Read('some/file/path/filename.json');

DuckDB function ST_Read_Meta

Description

Read the metadata from a variety of geospatial file formats using the GDAL library.

The ST_Read_Meta table function accompanies the ST_Read table function, but instead of reading the contents of a file, this function scans the metadata instead. Since the data model of the underlying GDAL library is quite flexible, most of the interesting metadata is within the returned layers column, which is a somewhat complex nested structure of DuckDB STRUCT and LIST types.

Usage

ST_Read_Meta(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Find the coordinate reference system authority name and code for the first layers first geometry column in the file
SELECT
    layers[1].geometry_fields[1].crs.auth_name as name,
    layers[1].geometry_fields[1].crs.auth_code as code
FROM st_read_meta('../../tmp/data/amsterdam_roads.fgb');

DuckDB function ST_ReadOSM

Description

The ST_ReadOsm() table function enables reading compressed OpenStreetMap data directly from a .osm.pbf file.

This function uses multithreading and zero-copy protobuf parsing which makes it a lot faster than using the ST_Read() OSM driver, however it only outputs the raw OSM data (Nodes, Ways, Relations), without constructing any geometries. For simple node entities (like PoI's) you can trivially construct POINT geometries, but it is also possible to construct LINESTRING and POLYGON geometries by manually joining refs and nodes together in SQL, although with available memory usually being a limiting factor. The ST_ReadOSM() function also provides a "replacement scan" to enable reading from a file directly as if it were a table. This is just syntax sugar for calling ST_ReadOSM() though. Example:

SELECT * FROM 'tmp/data/germany.osm.pbf' LIMIT 5;
```.

Usage

ST_ReadOSM(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT *
FROM ST_ReadOSM('tmp/data/germany.osm.pbf')
WHERE tags['highway'] != []
LIMIT 5;
-- +----------------------+--------+----------------------+---------+--------------------+------------+-----------+------------------------+
-- |         kind         |   id   |         tags         |  refs   |        lat         |    lon     | ref_roles |       ref_types        |
-- | enum('node', 'way'…  | int64  | map(varchar, varch…  | int64[] |       double       |   double   | varchar[] | enum('node', 'way', …  |
-- +----------------------+--------+----------------------+---------+--------------------+------------+-----------+------------------------+
-- | node                 | 122351 | {bicycle=yes, butt…  |         |         53.5492951 |   9.977553 |           |                        |
-- | node                 | 122397 | {crossing=no, high…  |         | 53.520990100000006 | 10.0156924 |           |                        |
-- | node                 | 122493 | {TMC:cid_58:tabcd_…  |         | 53.129614600000004 |  8.1970173 |           |                        |
-- | node                 | 123566 | {highway=traffic_s…  |         | 54.617268200000005 |  8.9718171 |           |                        |
-- | node                 | 125801 | {TMC:cid_58:tabcd_…  |         | 53.070685000000005 |  8.7819939 |           |                        |
-- +----------------------+--------+----------------------+---------+--------------------+------------+-----------+------------------------+

DuckDB function ST_ReadSHP

Description

Read a Shapefile without relying on the GDAL library.

Usage

ST_ReadSHP(col0, encoding)

Arguments

col0, encoding

VARCHAR

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_ReducePrecision

Description

Returns the geometry with all vertices reduced to the given precision.

Usage

ST_ReducePrecision(geom, precision)

Arguments

geom

GEOMETRY

precision

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_RemoveRepeatedPoints

Description

  • ST_RemoveRepeatedPoints(line = LINESTRING_2D), ST_RemoveRepeatedPoints(line = LINESTRING_2D, tolerance = DOUBLE): Remove repeated points from a LINESTRING.

  • ST_RemoveRepeatedPoints(geom = GEOMETRY), ST_RemoveRepeatedPoints(geom = GEOMETRY, tolerance = DOUBLE): Returns the geometry with repeated points removed.

Usage

ST_RemoveRepeatedPoints(line, tolerance)

Arguments

line

LINESTRING_2D

tolerance

DOUBLE

Value

LINESTRING_2D | GEOMETRY

Overloads

  • ST_RemoveRepeatedPoints(line = LINESTRING_2D)

  • ST_RemoveRepeatedPoints(line = LINESTRING_2D, tolerance = DOUBLE)

  • ST_RemoveRepeatedPoints(geom = GEOMETRY)

  • ST_RemoveRepeatedPoints(geom = GEOMETRY, tolerance = DOUBLE)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Reverse

Description

Returns the geometry with the order of its vertices reversed.

Usage

ST_Reverse(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Rotate

Description

Alias of ST_RotateZ.

Usage

ST_Rotate(geom, radians)

Arguments

geom, radians

Unspecified.

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_RotateX

Description

Rotates a geometry around the X axis. This is a shorthand macro for calling ST_Affine.

Usage

ST_RotateX(geom, radians)

Arguments

geom, radians

Unspecified.

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Rotate a 3D point 90 degrees (π/2 radians) around the X-axis
SELECT ST_RotateX(ST_GeomFromText('POINT Z(0 1 0)'), pi()/2);
-- POINT Z (0 0 1)

DuckDB function ST_RotateY

Description

Rotates a geometry around the Y axis. This is a shorthand macro for calling ST_Affine.

Usage

ST_RotateY(geom, radians)

Arguments

geom, radians

Unspecified.

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Rotate a 3D point 90 degrees (π/2 radians) around the Y-axis
SELECT ST_RotateY(ST_GeomFromText('POINT Z(1 0 0)'), pi()/2);
-- POINT Z (0 0 -1)

DuckDB function ST_RotateZ

Description

Rotates a geometry around the Z axis. This is a shorthand macro for calling ST_Affine.

Usage

ST_RotateZ(geom, radians)

Arguments

geom, radians

Unspecified.

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Rotate a point 90 degrees (π/2 radians) around the Z-axis
SELECT ST_RotateZ(ST_Point(1, 0), pi()/2);
-- POINT (0 1)

DuckDB function ST_Scale

Description

DuckDB function ST_Scale().

Usage

ST_Scale(geom, xs, ys, zs)

Arguments

geom, xs, ys, zs

Unspecified.

Value

Unspecified.

Overloads

  • ST_Scale(geom, xs, ys, zs)

  • ST_Scale(geom, xs, ys)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function st_setcrs

Description

Sets the Coordinate Reference System (CRS) identifier of the geometry.

Usage

st_setcrs(geom, crs)

Arguments

geom

GEOMETRY

crs

VARCHAR

Value

GEOMETRY


DuckDB function ST_ShortestLine

Description

Returns the shortest line between two geometries.

Usage

ST_ShortestLine(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Simplify

Description

Returns a simplified version of the geometry.

Usage

ST_Simplify(geom, tolerance)

Arguments

geom

GEOMETRY

tolerance

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_SimplifyPreserveTopology

Description

Returns a simplified version of the geometry that preserves topology.

Usage

ST_SimplifyPreserveTopology(geom, tolerance)

Arguments

geom

GEOMETRY

tolerance

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Snap

Description

Snaps the vertices and segments of a geometry to another geometry's vertices within the given tolerance.

Usage

ST_Snap(geom, snap_to, tolerance)

Arguments

geom

GEOMETRY

snap_to

GEOMETRY

tolerance

DOUBLE

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_StartPoint

Description

Returns the start point of a LINESTRING.

Usage

ST_StartPoint(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY | POINT_2D

Overloads

  • ST_StartPoint(geom = GEOMETRY)

  • ST_StartPoint(line = LINESTRING_2D)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_SymDifference

Description

Returns the symmetric difference of two geometries.

Usage

ST_SymDifference(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_TileEnvelope

Description

The ST_TileEnvelope scalar function generates tile envelope rectangular polygons from specified zoom level and tile indices.

This is used in MVT generation to select the features corresponding to the tile extent. The envelope is in the Web Mercator coordinate reference system (EPSG:3857). The tile pyramid starts at zoom level 0, corresponding to a single tile for the world. Each zoom level doubles the number of tiles in each direction, such that zoom level 1 is 2 tiles wide by 2 tiles high, zoom level 2 is 4 tiles wide by 4 tiles high, and so on. Tile indices start at ⁠[x=0, y=0]⁠ at the top left, and increase down and right. For example, at zoom level 2, the top right tile is ⁠[x=3, y=0]⁠, the bottom left tile is ⁠[x=0, y=3]⁠, and the bottom right is ⁠[x=3, y=3]⁠.

SELECT ST_TileEnvelope(2, 3, 1);
```.


[x=0, y=0]: R:x=0,%20y=0
[x=3, y=0]: R:x=3,%20y=0
[x=0, y=3]: R:x=0,%20y=3
[x=3, y=3]: R:x=3,%20y=3

Usage

ST_TileEnvelope(tile_zoom, tile_x, tile_y)

Arguments

tile_zoom, tile_x, tile_y

INTEGER

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_TileEnvelope(2, 3, 1);
-- +-----------------------------------------------------------------------------------------------------------+
-- |                                         st_tileenvelope(2, 3, 1)                                          |
-- |                                                 geometry                                                  |
-- +-----------------------------------------------------------------------------------------------------------+
-- | POLYGON ((1.00188E+07 0, 1.00188E+07 1.00188E+07, 2.00375E+07 1.00188E+07, 2.00375E+07 0, 1.00188E+07 0)) |
-- +-----------------------------------------------------------------------------------------------------------+

DuckDB function ST_Touches

Description

Returns true if the geometries touch.

Usage

ST_Touches(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Transform

Description

Transforms a geometry between two coordinate systems

The source and target coordinate systems can be specified using any format that the PROJ library supports.

The third optional always_xy parameter can be used to force the input and output geometries to be interpreted as having a [easting, northing] coordinate axis order regardless of what the source and target coordinate system definition says. This is particularly useful when transforming to/from the WGS84/EPSG:4326 coordinate system (what most people think of when they hear "longitude"/"latitude" or "GPS coordinates"), which is defined as having a [latitude, longitude] axis order even though [longitude, latitude] is commonly used in practice (e.g. in GeoJSON). More details available in the PROJ documentation.

DuckDB spatial vendors its own static copy of the PROJ database of coordinate systems, so if you have your own installation of PROJ on your system the available coordinate systems may differ to what's available in other GIS software.

Usage

ST_Transform(box, source_crs, target_crs, always_xy)

Arguments

box

BOX_2D

source_crs

VARCHAR

target_crs

VARCHAR

always_xy

BOOLEAN

Value

BOX_2D | POINT_2D | GEOMETRY

Overloads

  • ST_Transform(box = BOX_2D, source_crs = VARCHAR, target_crs = VARCHAR)

  • ST_Transform(box = BOX_2D, source_crs = VARCHAR, target_crs = VARCHAR, always_xy = BOOLEAN)

  • ST_Transform(point = POINT_2D, source_crs = VARCHAR, target_crs = VARCHAR)

  • ST_Transform(point = POINT_2D, source_crs = VARCHAR, target_crs = VARCHAR, always_xy = BOOLEAN)

  • ST_Transform(geom = GEOMETRY, source_crs = VARCHAR, target_crs = VARCHAR)

  • ST_Transform(geom = GEOMETRY, source_crs = VARCHAR, target_crs = VARCHAR, always_xy = BOOLEAN)

  • ST_Transform(geom = GEOMETRY, target_crs = VARCHAR)

  • ST_Transform(geom = GEOMETRY, target_crs = VARCHAR, always_xy = BOOLEAN)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Transform a geometry from EPSG:4326 to EPSG:3857 (WGS84 to WebMercator)
-- Note that since WGS84 is defined as having a [latitude, longitude] axis order
-- we follow the standard and provide the input geometry using that axis order,
-- but the output will be [easting, northing] because that is what's defined by
-- WebMercator.

SELECT
    ST_Transform(
        st_point(52.373123, 4.892360),
        'EPSG:4326',
        'EPSG:3857'
    );
-- POINT (544615.0239773799 6867874.103539125)
-- 
-- -- Alternatively, let's say we got our input point from e.g. a GeoJSON file,
-- -- which uses WGS84 but with [longitude, latitude] axis order. We can use the
-- -- `always_xy` parameter to force the input geometry to be interpreted as having
-- -- a [northing, easting] axis order instead, even though the source coordinate
-- -- reference system definition (WGS84) says otherwise.
-- 
-- SELECT
--     ST_Transform(
--         -- note the axis order is reversed here
--         st_point(4.892360, 52.373123),
--         'EPSG:4326',
--         'EPSG:3857',
--         always_xy := true
--     );
-- POINT (544615.0239773799 6867874.103539125)
-- 
-- -- Transform a geometry from OSG36 British National Grid EPSG:27700 to EPSG:4326 WGS84
-- -- Standard transform is often fine for the first few decimal places before being wrong
-- -- which could result in an error starting at about 10m and possibly much more
-- SELECT ST_Transform(bng, 'EPSG:27700', 'EPSG:4326', xy := true) AS without_grid_file
-- FROM (SELECT ST_GeomFromText('POINT( 170370.718 11572.405 )') AS bng);
-- POINT (-5.202992651563592 49.96007490162923)
-- 
-- -- By using an official NTv2 grid file, we can reduce the error down around the 9th decimal place
-- -- which in theory is below a millimetre, and in practise unlikely that your coordinates are that precise
-- -- British National Grid "NTv2 format files" download available here:
-- -- https://www.ordnancesurvey.co.uk/products/os-net/for-developers
-- SELECT ST_Transform(bng
--     , '+proj=tmerc +lat_0=49 +lon_0=-2 +k=0.9996012717 +x_0=400000 +y_0=-100000 +ellps=airy +units=m +no_defs +nadgrids=/full/path/to/OSTN15-NTv2/OSTN15_NTv2_OSGBtoETRS.gsb +type=crs'
--     , 'EPSG:4326', xy := true) AS with_grid_file
-- FROM (SELECT ST_GeomFromText('POINT( 170370.718 11572.405 )') AS bng) t;
-- POINT (-5.203046090608746 49.96006137018598)

DuckDB function ST_Translate

Description

DuckDB function ST_Translate().

Usage

ST_Translate(geom, dx, dy, dz)

Arguments

geom, dx, dy, dz

Unspecified.

Value

Unspecified.

Overloads

  • ST_Translate(geom, dx, dy, dz)

  • ST_Translate(geom, dx, dy)

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_TransScale

Description

Translates and then scales a geometry in X and Y direction. This is a shorthand macro for calling ST_Affine.

Usage

ST_TransScale(geom, dx, dy, xs, ys)

Arguments

geom, dx, dy, xs, ys

Unspecified.

Value

Unspecified.

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- Translate by (1, 2) then scale by (2, 3)
SELECT ST_TransScale(ST_Point(1, 1), 1, 2, 2, 3);
-- POINT (4 9)

DuckDB function ST_Union

Description

Returns the union of two geometries.

Usage

ST_Union(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Union_Agg

Description

Computes the union of a set of input geometries.

Usage

ST_Union_Agg(col0)

Arguments

col0

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_VoronoiDiagram

Description

Returns the Voronoi diagram of the supplied MultiPoint geometry.

Usage

ST_VoronoiDiagram(geom)

Arguments

geom

GEOMETRY

Value

GEOMETRY

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_Within

Description

Returns true if the first geometry is within the second.

Usage

ST_Within(geom1, geom2)

Arguments

geom1

POINT_2D | GEOMETRY

geom2

POLYGON_2D | GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_WithinProperly

Description

Returns true if the first geometry \"properly\" is contained by the second geometry

This function functions the same as ST_ContainsProperly, but the arguments are swapped.

Usage

ST_WithinProperly(geom1, geom2)

Arguments

geom1, geom2

GEOMETRY

Value

BOOLEAN

Provided by

The spatial extension (LOAD spatial;).


DuckDB function ST_X

Description

Returns the X coordinate of a point geometry.

Usage

ST_X(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_X(geom = GEOMETRY)

  • ST_X(point = POINT_2D)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_X(ST_Point(1, 2))

DuckDB function ST_XMax

Description

Returns the maximum X coordinate of a geometry.

Usage

ST_XMax(box)

Arguments

box

BOX_2D | BOX_2DF

Value

DOUBLE | FLOAT

Overloads

  • ST_XMax(geom = GEOMETRY)

  • ST_XMax(point = POINT_2D)

  • ST_XMax(line = LINESTRING_2D)

  • ST_XMax(polygon = POLYGON_2D)

  • ST_XMax(box = BOX_2D)

  • ST_XMax(box = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_XMax(ST_Point(1, 2))

DuckDB function ST_XMin

Description

Returns the minimum X coordinate of a geometry.

Usage

ST_XMin(box)

Arguments

box

BOX_2D | BOX_2DF

Value

DOUBLE | FLOAT

Overloads

  • ST_XMin(geom = GEOMETRY)

  • ST_XMin(point = POINT_2D)

  • ST_XMin(line = LINESTRING_2D)

  • ST_XMin(polygon = POLYGON_2D)

  • ST_XMin(box = BOX_2D)

  • ST_XMin(box = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_XMin(ST_Point(1, 2))

DuckDB function ST_Y

Description

Returns the Y coordinate of a point geometry.

Usage

ST_Y(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Overloads

  • ST_Y(geom = GEOMETRY)

  • ST_Y(point = POINT_2D)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Y(ST_Point(1, 2))

DuckDB function ST_YMax

Description

Returns the maximum Y coordinate of a geometry.

Usage

ST_YMax(box)

Arguments

box

BOX_2D | BOX_2DF

Value

DOUBLE | FLOAT

Overloads

  • ST_YMax(geom = GEOMETRY)

  • ST_YMax(point = POINT_2D)

  • ST_YMax(line = LINESTRING_2D)

  • ST_YMax(polygon = POLYGON_2D)

  • ST_YMax(box = BOX_2D)

  • ST_YMax(box = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_YMax(ST_Point(1, 2))

DuckDB function ST_YMin

Description

Returns the minimum Y coordinate of a geometry.

Usage

ST_YMin(box)

Arguments

box

BOX_2D | BOX_2DF

Value

DOUBLE | FLOAT

Overloads

  • ST_YMin(geom = GEOMETRY)

  • ST_YMin(point = POINT_2D)

  • ST_YMin(line = LINESTRING_2D)

  • ST_YMin(polygon = POLYGON_2D)

  • ST_YMin(box = BOX_2D)

  • ST_YMin(box = BOX_2DF)

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_YMin(ST_Point(1, 2))

DuckDB function ST_Z

Description

Returns the Z coordinate of a point geometry.

Usage

ST_Z(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_Z(ST_Point(1, 2, 3))

DuckDB function ST_ZMax

Description

Returns the maximum Z coordinate of a geometry.

Usage

ST_ZMax(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_ZMax(ST_Point(1, 2, 3))

DuckDB function ST_ZMFlag

Description

Returns a flag indicating the presence of Z and M values in the input geometry. 0 = No Z or M values 1 = M values only 2 = Z values only 3 = Z and M values.

Usage

ST_ZMFlag(geom)

Arguments

geom

GEOMETRY

Value

UTINYINT

Provided by

The spatial extension (LOAD spatial;).

SQL examples

-- ZMFlag for a 2D geometry
SELECT ST_ZMFlag(ST_GeomFromText('POINT(1 1)'));
-- 0
-- 
-- -- ZMFlag for a 3DZ geometry
-- SELECT ST_ZMFlag(ST_GeomFromText('POINT Z(1 1 1)'));
-- 2
-- 
-- -- ZMFlag for a 3DM geometry
-- SELECT ST_ZMFlag(ST_GeomFromText('POINT M(1 1 1)'));
-- 1
-- 
-- -- ZMFlag for a 4D geometry
-- SELECT ST_ZMFlag(ST_GeomFromText('POINT ZM(1 1 1 1)'));
-- 3

DuckDB function ST_ZMin

Description

Returns the minimum Z coordinate of a geometry.

Usage

ST_ZMin(geom)

Arguments

geom

GEOMETRY

Value

DOUBLE

Provided by

The spatial extension (LOAD spatial;).

SQL examples

SELECT ST_ZMin(ST_Point(1, 2, 3))

DuckDB function start_ui

Description

DuckDB function start_ui().

Usage

start_ui()

Value

Unspecified.

Provided by

The ui extension (LOAD ui;).


DuckDB function start_ui_server

Description

DuckDB function start_ui_server().

Usage

start_ui_server()

Value

Unspecified.

Provided by

The ui extension (LOAD ui;).


DuckDB function stats

Description

Returns a string with statistics about the expression. Expression can be a column, constant, or SQL expression.

Usage

stats(expression)

Arguments

expression

ANY

Value

VARCHAR

SQL examples

stats(5)

DuckDB function stddev_pop

Description

Returns the population standard deviation.

Usage

stddev_pop(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

sqrt(var_pop(x))

DuckDB function stddev_samp

Description

Returns the sample standard deviation.

Usage

stddev_samp(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

sqrt(var_samp(x))

DuckDB function stem

Description

DuckDB function stem().

Usage

stem(col0, col1)

Arguments

col0, col1

VARCHAR

Value

VARCHAR

Provided by

The fts extension (LOAD fts;).


DuckDB function stop_ui_server

Description

DuckDB function stop_ui_server().

Usage

stop_ui_server()

Value

Unspecified.

Provided by

The ui extension (LOAD ui;).


DuckDB function storage_info

Description

DuckDB function storage_info().

Usage

storage_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function strftime

Description

Converts a date to a string according to the format string.

Usage

strftime(data, format)

Arguments

data

⁠DATE | TIMESTAMP | TIMESTAMP_NS | VARCHAR | TIMESTAMP WITH TIME ZONE⁠

format

⁠VARCHAR | DATE | TIMESTAMP | TIMESTAMP_NS | TIMESTAMP WITH TIME ZONE⁠

Value

VARCHAR

SQL examples

strftime(date '1992-01-01', '%a, %-d %B %Y')

DuckDB function string_agg

Description

Concatenates the column string values with an optional separator.

Usage

string_agg(str, arg)

Arguments

str

ANY

arg

VARCHAR

Value

VARCHAR

Overloads

  • string_agg(str = ANY)

  • string_agg(str = ANY, arg = VARCHAR)

SQL examples

string_agg(A, '-')

DuckDB function string_split_regex

Description

Splits the string along the regex. A set of optional regex options can be set.

Usage

string_split_regex(string, regex, options)

Arguments

string, regex, options

VARCHAR

Value

VARCHAR[]

Overloads

  • string_split_regex(string = VARCHAR, regex = VARCHAR)

  • string_split_regex(string = VARCHAR, regex = VARCHAR, options = VARCHAR)

SQL examples

string_split_regex('hello world; 42', ';? ')

See Also

Other regex: regexp_escape(), regexp_extract(), regexp_extract_all(), regexp_full_match(), regexp_matches(), regexp_replace()


DuckDB function strptime

Description

  • strptime(text = VARCHAR, format = VARCHAR): Converts the string text to timestamp according to the format string. Throws an error on failure. To return NULL on failure, use try_strptime.

  • strptime(text = VARCHAR, format.list = `VARCHAR[]`): Converts the string text to timestamp applying the format strings in the list until one succeeds. Throws an error on failure. To return NULL on failure, use try_strptime.

Usage

strptime(text, format)

Arguments

text, format

VARCHAR

Value

TIMESTAMP

Overloads

  • strptime(text = VARCHAR, format = VARCHAR)

  • strptime(text = VARCHAR, format.list = `VARCHAR[]`)

SQL examples

strptime('Wed, 1 January 1992 - 08:38:40 PM', '%a, %-d %B %Y - %I:%M:%S %p')
strptime('4/15/2023 10:56:00', ['%d/%m/%Y %H:%M:%S', '%m/%d/%Y %H:%M:%S'])

DuckDB function struct_concat

Description

Merge the multiple STRUCTs into a single STRUCT.

Usage

struct_concat()

Value

STRUCT

SQL examples

struct_concat(struct_pack(i := 4), struct_pack(s := 'string'))

DuckDB function struct_contains

Description

Check if an unnamed STRUCT contains the value.

Usage

struct_contains(struct, entry)

Arguments

struct

STRUCT

entry

ANY

Value

BOOLEAN

SQL examples

struct_contains(ROW(3, 3, 0), 3)

DuckDB function struct_extract

Description

Extract the named entry from the STRUCT.

Usage

struct_extract(struct, entry)

Arguments

struct

STRUCT

entry

VARCHAR | BIGINT

Value

ANY

SQL examples

struct_extract({'i': 3, 'v2': 3, 'v3': 0}, 'i')

DuckDB function struct_extract_at

Description

Extract the entry from the STRUCT by position (starts at 1!).

Usage

struct_extract_at(struct, entry)

Arguments

struct

STRUCT

entry

BIGINT

Value

ANY

SQL examples

struct_extract_at({'i': 3, 'v2': 3, 'v3': 0}, 2)

DuckDB function struct_insert

Description

Adds field(s)/value(s) to an existing STRUCT with the argument values. The entry name(s) will be the bound variable name(s).

Usage

struct_insert()

Value

STRUCT

SQL examples

struct_insert({'a': 1}, b := 2)

DuckDB function struct_keys

Description

Returns the field names of a STRUCT as a list.

Usage

struct_keys(struct)

Arguments

struct

ANY

Value

VARCHAR[]

SQL examples

struct_keys({'a': 1, 'b': 2})

DuckDB function struct_pack

Description

Create a STRUCT containing the argument values. The entry name will be the bound variable name.

Usage

struct_pack()

Value

STRUCT

SQL examples

struct_pack(i := 4, s := 'string')

DuckDB function struct_position

Description

Get the position of the entry in an unnamed STRUCT, starting at 1.

Usage

struct_position(struct, entry)

Arguments

struct

STRUCT

entry

ANY

Value

INTEGER

SQL examples

struct_position(ROW(3, 3, 0), 3)

DuckDB function struct_update

Description

Changes field(s)/value(s) to an existing STRUCT with the argument values. The entry name(s) will be the bound variable name(s).

Usage

struct_update()

Value

STRUCT

SQL examples

struct_update({'a': 1}, a := 2)

DuckDB function struct_values

Description

Returns the field values of a STRUCT as an UnnamedStruct.

Usage

struct_values(struct)

Arguments

struct

STRUCT

Value

STRUCT

SQL examples

struct_values({'a': 1, 'b': 'world'})

DuckDB function substring

Description

Extracts substring starting from character start up to the end of the string. If optional argument length is set, extracts a substring of length characters instead. Note that a start value of 1 refers to the first character of the string.

Usage

substring(string, start, length)

Arguments

string

VARCHAR

start

BIGINT

length

BIGINT

Value

VARCHAR

Overloads

  • substring(string = VARCHAR, start = BIGINT, length = BIGINT)

  • substring(string = VARCHAR, start = BIGINT)

SQL examples

substring('Hello', 2)
substring('Hello', 2, 2)

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function substring_grapheme

Description

Extracts substring starting from grapheme clusters start up to the end of the string. If optional argument length is set, extracts a substring of length grapheme clusters instead. Note that a start value of 1 refers to the first character of the string.

Usage

substring_grapheme(string, start, length)

Arguments

string

VARCHAR

start

BIGINT

length

BIGINT

Value

VARCHAR

Overloads

  • substring_grapheme(string = VARCHAR, start = BIGINT, length = BIGINT)

  • substring_grapheme(string = VARCHAR, start = BIGINT)

SQL examples

substring_grapheme('🦆🤦🏼‍♂️🤦🏽‍♀️🦆', 3)
substring_grapheme('🦆🤦🏼‍♂️🤦🏽‍♀️🦆', 3, 2)

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), suffix(), to_base(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function subtract

Description

DuckDB function subtract().

Usage

subtract(col0, col1)

Arguments

col0

⁠TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIGNUM | DATE | TIMESTAMP | INTERVAL | TIME | TIME WITH TIME ZONE⁠

col1

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIGNUM | DATE | TIMESTAMP | INTERVAL

Value

⁠TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIGNUM | DATE | INTERVAL | TIMESTAMP | TIME | TIME WITH TIME ZONE⁠

Overloads

  • subtract(col0 = TINYINT)

  • subtract(col0 = TINYINT, col1 = TINYINT)

  • subtract(col0 = SMALLINT)

  • subtract(col0 = SMALLINT, col1 = SMALLINT)

  • subtract(col0 = INTEGER)

  • subtract(col0 = INTEGER, col1 = INTEGER)

  • subtract(col0 = BIGINT)

  • subtract(col0 = BIGINT, col1 = BIGINT)

  • subtract(col0 = HUGEINT)

  • subtract(col0 = HUGEINT, col1 = HUGEINT)

  • subtract(col0 = FLOAT)

  • subtract(col0 = FLOAT, col1 = FLOAT)

  • subtract(col0 = DOUBLE)

  • subtract(col0 = DOUBLE, col1 = DOUBLE)

  • subtract(col0 = DECIMAL)

  • subtract(col0 = DECIMAL, col1 = DECIMAL)

  • subtract(col0 = UTINYINT)

  • subtract(col0 = UTINYINT, col1 = UTINYINT)

  • subtract(col0 = USMALLINT)

  • subtract(col0 = USMALLINT, col1 = USMALLINT)

  • subtract(col0 = UINTEGER)

  • subtract(col0 = UINTEGER, col1 = UINTEGER)

  • subtract(col0 = UBIGINT)

  • subtract(col0 = UBIGINT, col1 = UBIGINT)

  • subtract(col0 = UHUGEINT)

  • subtract(col0 = UHUGEINT, col1 = UHUGEINT)

  • subtract(col0 = BIGNUM)

  • subtract(col0 = BIGNUM, col1 = BIGNUM)

  • subtract(col0 = DATE, col1 = DATE)

  • subtract(col0 = DATE, col1 = INTEGER)

  • subtract(col0 = TIMESTAMP, col1 = TIMESTAMP)

  • subtract(col0 = INTERVAL, col1 = INTERVAL)

  • subtract(col0 = DATE, col1 = INTERVAL)

  • subtract(col0 = TIME, col1 = INTERVAL)

  • subtract(col0 = TIMESTAMP, col1 = INTERVAL)

  • subtract(col0 = `TIME WITH TIME ZONE`, col1 = INTERVAL)

  • subtract(col0 = INTERVAL)


DuckDB function sum

Description

Calculates the sum value for all tuples in arg.

Usage

sum(arg)

Arguments

arg

DECIMAL | BOOLEAN | SMALLINT | INTEGER | BIGINT | HUGEINT | DOUBLE | BIGNUM

Value

DECIMAL | HUGEINT | DOUBLE | BIGNUM

SQL examples

sum(A)

DuckDB function sum_no_overflow

Description

Internal only. Calculates the sum value for all tuples in arg without overflow checks.

Usage

sum_no_overflow(arg)

Arguments

arg

INTEGER | BIGINT | DECIMAL

Value

HUGEINT | DECIMAL

SQL examples

sum_no_overflow(A)

DuckDB function summary

Description

DuckDB function summary().

Usage

summary(col0)

Arguments

col0

TABLE

Value

Unspecified.


DuckDB function switch

Description

Creates a switch statement similar to CASE WHEN/THEN.

Usage

switch(key, map)

Arguments

key

K | MAP(K, V)

map

MAP(K, V) | V

Value

V

Overloads

  • switch(key = K, map = `MAP(K, V)`)

  • switch(key = K, map = `MAP(K, V)`, value = V)

  • switch(key = `MAP(K, V)`, map = V)

  • switch(key = `MAP(K, V)`)

SQL examples

switch(x, map({1 : 1}, default)

DuckDB function table_info

Description

DuckDB function table_info().

Usage

table_info(col0)

Arguments

col0

VARCHAR

Value

Unspecified.


DuckDB function tan

Description

Computes the tan of x.

Usage

tan(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

tan(90)

DuckDB function tanh

Description

Computes the hyperbolic tan of x.

Usage

tanh(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

tanh(1)

DuckDB function test_all_types

Description

DuckDB function test_all_types().

Usage

test_all_types(use_large_bignum, use_large_enum)

Arguments

use_large_bignum, use_large_enum

BOOLEAN

Value

Unspecified.


DuckDB function test_vector_types

Description

DuckDB function test_vector_types().

Usage

test_vector_types(col0, all_flat)

Arguments

col0

ANY

all_flat

BOOLEAN

Value

Unspecified.


DuckDB function text

Description

DuckDB function text().

Usage

text(col0, col1)

Arguments

col0

DOUBLE

col1

VARCHAR

Value

VARCHAR

Provided by

The excel extension (LOAD excel;).


DuckDB function time_bucket

Description

Truncate TIMESTAMPTZ by the specified interval bucket_width. Buckets are aligned relative to origin TIMESTAMPTZ. The origin defaults to 2000-01-03 00:00:00+00 for buckets that do not include a month or year interval, and to 2000-01-01 00:00:00+00 for month and year buckets.

Usage

time_bucket(bucket_width, timestamp, origin)

Arguments

bucket_width

INTERVAL

timestamp

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

origin

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE | VARCHAR⁠

Value

⁠DATE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Overloads

  • time_bucket(bucket_width = INTERVAL, timestamp = DATE)

  • time_bucket(bucket_width = INTERVAL, timestamp = DATE, origin = DATE)

  • time_bucket(bucket_width = INTERVAL, timestamp = DATE, origin = INTERVAL)

  • time_bucket(bucket_width = INTERVAL, timestamp = TIMESTAMP)

  • time_bucket(bucket_width = INTERVAL, timestamp = TIMESTAMP, origin = INTERVAL)

  • time_bucket(bucket_width = INTERVAL, timestamp = TIMESTAMP, origin = TIMESTAMP)

  • time_bucket(bucket_width = INTERVAL, timestamp = `TIMESTAMP WITH TIME ZONE`)

  • time_bucket(bucket_width = INTERVAL, timestamp = `TIMESTAMP WITH TIME ZONE`, origin = INTERVAL)

  • time_bucket(bucket_width = INTERVAL, timestamp = `TIMESTAMP WITH TIME ZONE`, origin = `TIMESTAMP WITH TIME ZONE`)

  • time_bucket(bucket_width = INTERVAL, timestamp = `TIMESTAMP WITH TIME ZONE`, origin = VARCHAR)

SQL examples

time_bucket(INTERVAL '2 weeks', TIMESTAMP '1992-04-20 15:26:00-07', TIMESTAMP '1992-04-01 00:00:00-07')

DuckDB function timetz_byte_comparable

Description

Converts a TIME WITH TIME ZONE to an integer sort key.

Usage

timetz_byte_comparable(time_tz)

Arguments

time_tz

⁠TIME WITH TIME ZONE⁠

Value

UBIGINT

SQL examples

timetz_byte_comparable('18:18:16.21-07:00'::TIMETZ)

DuckDB function timezone

Description

Extract the timezone component from a date or timestamp.

Usage

timezone(ts, col1)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE | VARCHAR⁠

col1

⁠TIME WITH TIME ZONE | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

⁠BIGINT | TIME WITH TIME ZONE | TIMESTAMP WITH TIME ZONE | TIMESTAMP⁠

Overloads

  • timezone(ts = DATE)

  • timezone(ts = INTERVAL)

  • timezone(ts = INTERVAL, col1 = `TIME WITH TIME ZONE`)

  • timezone(ts = TIMESTAMP)

  • timezone(ts = `TIMESTAMP WITH TIME ZONE`)

  • timezone(ts = VARCHAR, col1 = TIMESTAMP)

  • timezone(ts = VARCHAR, col1 = `TIMESTAMP WITH TIME ZONE`)

  • timezone(ts = VARCHAR, col1 = `TIME WITH TIME ZONE`)

SQL examples

timezone(timestamp '2021-08-03 11:59:44.123456')

DuckDB function timezone_hour

Description

Extract the timezone_hour component from a date or timestamp.

Usage

timezone_hour(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

timezone_hour(timestamp '2021-08-03 11:59:44.123456')

DuckDB function timezone_minute

Description

Extract the timezone_minute component from a date or timestamp.

Usage

timezone_minute(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

timezone_minute(timestamp '2021-08-03 11:59:44.123456')

DuckDB function to_base

Description

Converts number to a string in the given base radix, optionally padding with leading zeros to min_length.

Usage

to_base(number, radix, min_length)

Arguments

number

BIGINT

radix

INTEGER

min_length

INTEGER

Value

VARCHAR

Overloads

  • to_base(number = BIGINT, radix = INTEGER)

  • to_base(number = BIGINT, radix = INTEGER, min_length = INTEGER)

SQL examples

to_base(42, 16, 5)

See Also

Other numeric: bin(), bit_length(), formatReadableDecimalSize(), format_bytes(), greatest(), hex(), least(), len(), parse_formatted_bytes()

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base64(), translate(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function to_centuries

Description

Construct a century interval.

Usage

to_centuries(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_centuries(5)

DuckDB function to_days

Description

Construct a day interval.

Usage

to_days(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_days(5)

DuckDB function to_decades

Description

Construct a decade interval.

Usage

to_decades(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_decades(5)

DuckDB function to_hours

Description

Construct a hour interval.

Usage

to_hours(integer)

Arguments

integer

BIGINT

Value

INTERVAL

SQL examples

to_hours(5)

DuckDB function to_json

Description

DuckDB function to_json().

Usage

to_json()

Value

JSON

Provided by

The json extension (LOAD json;).


DuckDB function to_microseconds

Description

Construct a microsecond interval.

Usage

to_microseconds(integer)

Arguments

integer

BIGINT

Value

INTERVAL

SQL examples

to_microseconds(5)

DuckDB function to_millennia

Description

Construct a millenium interval.

Usage

to_millennia(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_millennia(1)

DuckDB function to_milliseconds

Description

Construct a millisecond interval.

Usage

to_milliseconds(double)

Arguments

double

DOUBLE

Value

INTERVAL

SQL examples

to_milliseconds(5.5)

DuckDB function to_minutes

Description

Construct a minute interval.

Usage

to_minutes(integer)

Arguments

integer

BIGINT

Value

INTERVAL

SQL examples

to_minutes(5)

DuckDB function to_months

Description

Construct a month interval.

Usage

to_months(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_months(5)

DuckDB function to_quarters

Description

Construct a quarter interval.

Usage

to_quarters(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_quarters(5)

DuckDB function to_seconds

Description

Construct a second interval.

Usage

to_seconds(double)

Arguments

double

DOUBLE

Value

INTERVAL

SQL examples

to_seconds(5.5)

DuckDB function to_timestamp

Description

Converts secs since epoch to a timestamp with time zone.

Usage

to_timestamp(sec)

Arguments

sec

DOUBLE

Value

⁠TIMESTAMP WITH TIME ZONE⁠

SQL examples

to_timestamp(1284352323.5)

DuckDB function to_weeks

Description

Construct a week interval.

Usage

to_weeks(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_weeks(5)

DuckDB function to_years

Description

Construct a year interval.

Usage

to_years(integer)

Arguments

integer

INTEGER | BIGINT

Value

INTERVAL

SQL examples

to_years(5)

DuckDB function today

Description

DuckDB function today().

Usage

today()

Value

DATE

Provided by

The icu extension (LOAD icu;).


DuckDB function tpcds

Description

DuckDB function tpcds().

Usage

tpcds(col0)

Arguments

col0

BIGINT

Value

Unspecified.

Provided by

The tpcds extension (LOAD tpcds;).


DuckDB function tpcds_answers

Description

DuckDB function tpcds_answers().

Usage

tpcds_answers()

Value

Unspecified.

Provided by

The tpcds extension (LOAD tpcds;).


DuckDB function tpcds_queries

Description

DuckDB function tpcds_queries().

Usage

tpcds_queries()

Value

Unspecified.

Provided by

The tpcds extension (LOAD tpcds;).


DuckDB function tpch

Description

DuckDB function tpch().

Usage

tpch(col0)

Arguments

col0

BIGINT

Value

Unspecified.

Provided by

The tpch extension (LOAD tpch;).


DuckDB function tpch_answers

Description

DuckDB function tpch_answers().

Usage

tpch_answers()

Value

Unspecified.

Provided by

The tpch extension (LOAD tpch;).


DuckDB function tpch_queries

Description

DuckDB function tpch_queries().

Usage

tpch_queries()

Value

Unspecified.

Provided by

The tpch extension (LOAD tpch;).


DuckDB function translate

Description

Replaces each character in string that matches a character in the from set with the corresponding character in the to set. If from is longer than to, occurrences of the extra characters in from are deleted.

Usage

translate(string, from, to)

Arguments

string, from, to

VARCHAR

Value

VARCHAR

SQL examples

translate('12345', '143', 'ax')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), trim(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function trim

Description

Removes any occurrences of any of the characters from either side of the string. characters defaults to space.

Usage

trim(string, characters)

Arguments

string, characters

VARCHAR

Value

VARCHAR

Overloads

  • trim(string = VARCHAR)

  • trim(string = VARCHAR, characters = VARCHAR)

SQL examples

trim('    test  ')
trim('>>>>test<<', '><')

See Also

Other string: array_extract(), ascii(), bar(), bin(), bit_length(), chr(), concat(), concat_ws(), contains(), format(), formatReadableDecimalSize(), format_bytes(), from_base64(), greatest(), hash(), hex(), ilike_escape(), instr(), least(), left(), left_grapheme(), len(), length_grapheme(), like_escape(), list_slice(), lower(), lpad(), ltrim(), md5(), md5_number(), nfc_normalize(), not_ilike_escape(), not_like_escape(), or–or, parse_dirname(), parse_dirpath(), parse_filename(), parse_formatted_bytes(), parse_path(), prefix(), printf(), repeat(), replace(), reverse(), right(), right_grapheme(), rpad(), rtrim(), sha1(), sha256(), starts_with(), string_split(), strip_accents(), strlen(), substring(), substring_grapheme(), suffix(), to_base(), to_base64(), translate(), unbin(), unhex(), unicode(), upper(), url_decode(), url_encode()


DuckDB function trunc

Description

Truncates the number.

Usage

trunc(x, col1)

Arguments

x

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

col1

INTEGER

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | FLOAT | DOUBLE | DECIMAL | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT

Overloads

  • trunc(x = TINYINT)

  • trunc(x = TINYINT, col1 = INTEGER)

  • trunc(x = SMALLINT)

  • trunc(x = SMALLINT, col1 = INTEGER)

  • trunc(x = INTEGER)

  • trunc(x = INTEGER, col1 = INTEGER)

  • trunc(x = BIGINT)

  • trunc(x = BIGINT, col1 = INTEGER)

  • trunc(x = HUGEINT)

  • trunc(x = HUGEINT, col1 = INTEGER)

  • trunc(x = FLOAT)

  • trunc(x = FLOAT, col1 = INTEGER)

  • trunc(x = DOUBLE)

  • trunc(x = DOUBLE, col1 = INTEGER)

  • trunc(x = DECIMAL)

  • trunc(x = DECIMAL, col1 = INTEGER)

  • trunc(x = UTINYINT)

  • trunc(x = UTINYINT, col1 = INTEGER)

  • trunc(x = USMALLINT)

  • trunc(x = USMALLINT, col1 = INTEGER)

  • trunc(x = UINTEGER)

  • trunc(x = UINTEGER, col1 = INTEGER)

  • trunc(x = UBIGINT)

  • trunc(x = UBIGINT, col1 = INTEGER)

  • trunc(x = UHUGEINT)

  • trunc(x = UHUGEINT, col1 = INTEGER)

SQL examples

trunc(17.4)

DuckDB function truncate_duckdb_logs

Description

DuckDB function truncate_duckdb_logs().

Usage

truncate_duckdb_logs()

Value

Unspecified.


DuckDB function try_strptime

Description

Converts the string text to timestamp according to the format string. Returns NULL on failure.

Usage

try_strptime(text, format)

Arguments

text

VARCHAR

format

VARCHAR | VARCHAR[]

Value

TIMESTAMP

SQL examples

try_strptime('Wed, 1 January 1992 - 08:38:40 PM', '%a, %-d %B %Y - %I:%M:%S %p')

DuckDB function txid_current

Description

Returns the current transaction’s ID (a BIGINT). It will assign a new one if the current transaction does not have one already.

Usage

txid_current()

Value

UBIGINT

SQL examples

txid_current()

DuckDB function typeof

Description

Returns the name of the data type of the result of the expression.

Usage

typeof(expression)

Arguments

expression

ANY

Value

VARCHAR

SQL examples

typeof('abc')

DuckDB function ui_is_started

Description

DuckDB function ui_is_started().

Usage

ui_is_started()

Value

Unspecified.

Provided by

The ui extension (LOAD ui;).


DuckDB function union_extract

Description

Extract the value with the named tags from the union. NULL if the tag is not currently selected.

Usage

union_extract(union, tag)

Arguments

union

UNION

tag

VARCHAR

Value

ANY

SQL examples

union_extract(s, 'k')

DuckDB function union_tag

Description

Retrieve the currently selected tag of the union as an ENUM.

Usage

union_tag(union)

Arguments

union

UNION

Value

ANY

SQL examples

union_tag(union_value(k := 'foo'))

DuckDB function union_value

Description

Create a single member UNION containing the argument value. The tag of the value will be the bound variable name.

Usage

union_value()

Value

UNION

SQL examples

union_value(k := 'hello')

DuckDB function unity_catalog_checkpoint_table

Description

DuckDB function unity_catalog_checkpoint_table().

Usage

unity_catalog_checkpoint_table(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The unity_catalog extension (LOAD unity_catalog;).


DuckDB function unity_catalog_force_checkpoint_table

Description

DuckDB function unity_catalog_force_checkpoint_table().

Usage

unity_catalog_force_checkpoint_table(col0)

Arguments

col0

VARCHAR

Value

Unspecified.

Provided by

The unity_catalog extension (LOAD unity_catalog;).


DuckDB function unnest

Description

DuckDB function unnest().

Usage

unnest(col0)

Arguments

col0

ANY

Value

Unspecified.


DuckDB function user

Description

DuckDB macro user().

Usage

user()

Value

Unspecified.


DuckDB function user_agent

Description

DuckDB function user_agent().

Usage

user_agent()

Value

Unspecified.


DuckDB function uuid

Description

Returns a random UUID v4 similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687.

Usage

uuid()

Value

UUID

SQL examples

uuid()

DuckDB function uuid_extract_timestamp

Description

Extract the timestamp for the given UUID v7.

Usage

uuid_extract_timestamp(uuid)

Arguments

uuid

UUID

Value

⁠TIMESTAMP WITH TIME ZONE⁠

SQL examples

uuid_extract_timestamp('019482e4-1441-7aad-8127-eec99573b0a0')

DuckDB function uuid_extract_version

Description

Extract a version for the given UUID.

Usage

uuid_extract_version(uuid)

Arguments

uuid

UUID

Value

UINTEGER

SQL examples

uuid_extract_version('019482e4-1441-7aad-8127-eec99573b0a0')

DuckDB function uuidv4

Description

Returns a random UUIDv4 similar to this: eeccb8c5-9943-b2bb-bb5e-222f4e14b687.

Usage

uuidv4()

Value

UUID

SQL examples

uuidv4()

DuckDB function uuidv7

Description

Returns a random UUID v7 similar to this: 019482e4-1441-7aad-8127-eec99573b0a0.

Usage

uuidv7()

Value

UUID

SQL examples

uuidv7()

DuckDB function var_pop

Description

Returns the population variance.

Usage

var_pop(x)

Arguments

x

DOUBLE

Value

DOUBLE


DuckDB function var_samp

Description

Returns the sample variance of all input values.

Usage

var_samp(x)

Arguments

x

DOUBLE

Value

DOUBLE

SQL examples

(SUM(x^2) - SUM(x)^2 / COUNT(x)) / (COUNT(x) - 1)

DuckDB function variant_bytes_to_variant

Description

DuckDB function variant_bytes_to_variant().

Usage

variant_bytes_to_variant(col0)

Arguments

col0

BLOB

Value

VARIANT


DuckDB function variant_extract

Description

  • variant_extract(input_variant = VARIANT, field = VARCHAR): Returns the field from the input_variant if it's an OBJECT.

  • variant_extract(input_variant = VARIANT, index = UINTEGER): Returns the entry at index from the input_variant if it's an ARRAY.

Usage

variant_extract(input_variant, field)

Arguments

input_variant

VARIANT

field

VARCHAR

Value

VARIANT

Overloads

  • variant_extract(input_variant = VARIANT, field = VARCHAR)

  • variant_extract(input_variant = VARIANT, index = UINTEGER)

SQL examples

variant_extract({'a': 42, 'b': [1,2,3])::VARIANT, 'b')
variant_extract([1,2,3])::VARIANT, 0)

See Also

Other variant: variant_normalize(), variant_typeof()


DuckDB function variant_normalize

Description

Normalizes the input_variant to a canonical representation.

Usage

variant_normalize(input_variant)

Arguments

input_variant

VARIANT

Value

VARIANT

SQL examples

variant_normalize({'b': [1,2,3], 'a': 42})::VARIANT)

See Also

Other variant: variant_extract(), variant_typeof()


DuckDB function variant_to_parquet_variant

Description

DuckDB function variant_to_parquet_variant().

Usage

variant_to_parquet_variant(col0)

Arguments

col0

VARIANT

Value

ANY


DuckDB function variant_typeof

Description

Returns the internal type of the input_variant.

Usage

variant_typeof(input_variant)

Arguments

input_variant

VARIANT

Value

VARCHAR

SQL examples

variant_typeof({'a': 42, 'b': [1,2,3]})::VARIANT)

See Also

Other variant: variant_extract(), variant_normalize()


DuckDB function vector_type

Description

Returns the VectorType of a given column.

Usage

vector_type(col)

Arguments

col

ANY

Value

VARCHAR

SQL examples

vector_type(col)

DuckDB function verify_external

Description

DuckDB function verify_external().

Usage

verify_external()

Value

Unspecified.


DuckDB function verify_fetch_row

Description

DuckDB function verify_fetch_row().

Usage

verify_fetch_row()

Value

Unspecified.


DuckDB function verify_parallelism

Description

DuckDB function verify_parallelism().

Usage

verify_parallelism()

Value

Unspecified.


DuckDB function verify_serializer

Description

DuckDB function verify_serializer().

Usage

verify_serializer()

Value

Unspecified.


DuckDB function version

Description

Returns the currently active version of DuckDB in this format: v0.3.2 .

Usage

version()

Value

VARCHAR

SQL examples

version()

DuckDB function vortex_scan

Description

DuckDB function vortex_scan().

Usage

vortex_scan(col0)

Arguments

col0

VARCHAR | VARCHAR[]

Value

Unspecified.

Provided by

The vortex extension (LOAD vortex;).


DuckDB function vss_join

Description

DuckDB macro vss_join().

Usage

vss_join(left_table, right_table, left_col, right_col, k, metric)

Arguments

left_table, right_table, left_col, right_col, k, metric

Unspecified.

Value

Unspecified.

Provided by

The vss extension (LOAD vss;).


DuckDB function vss_match

Description

DuckDB macro vss_match().

Usage

vss_match(right_table, left_col, right_col, k, metric)

Arguments

right_table, left_col, right_col, k, metric

Unspecified.

Value

Unspecified.

Provided by

The vss extension (LOAD vss;).


DuckDB function wavg

Description

DuckDB macro wavg().

Usage

wavg(value, weight)

Arguments

value, weight

Unspecified.

Value

Unspecified.


DuckDB function week

Description

Extract the week component from a date or timestamp.

Usage

week(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

week(timestamp '2021-08-03 11:59:44.123456')

DuckDB function weekday

Description

Extract the weekday component from a date or timestamp.

Usage

weekday(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

weekday(timestamp '2021-08-03 11:59:44.123456')

DuckDB function weekofyear

Description

Extract the weekofyear component from a date or timestamp.

Usage

weekofyear(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

weekofyear(timestamp '2021-08-03 11:59:44.123456')

DuckDB function weighted_avg

Description

DuckDB macro weighted_avg().

Usage

weighted_avg(value, weight)

Arguments

value, weight

Unspecified.

Value

Unspecified.


DuckDB function which_secret

Description

DuckDB function which_secret().

Usage

which_secret(col0, col1)

Arguments

col0, col1

VARCHAR

Value

Unspecified.


DuckDB function whoami

Description

DuckDB macro whoami().

Usage

whoami()

Value

Unspecified.

Provided by

The quack extension (LOAD quack;).


DuckDB function write_blob

Description

DuckDB function write_blob().

Usage

write_blob(col0, col1)

Arguments

col0

VARCHAR

col1

BLOB

Value

BOOLEAN

Provided by

The delta extension (LOAD delta;).


DuckDB function write_log

Description

Writes to the logger.

Usage

write_log(string)

Arguments

string

VARCHAR

Value

ANY

SQL examples

write_log('Hello')

DuckDB function xor

Description

Bitwise XOR.

Usage

xor(left, right)

Arguments

left, right

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

Value

TINYINT | SMALLINT | INTEGER | BIGINT | HUGEINT | UTINYINT | USMALLINT | UINTEGER | UBIGINT | UHUGEINT | BIT

SQL examples

xor(17, 5)

DuckDB function year

Description

Extract the year component from a date or timestamp.

Usage

year(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

year(timestamp '2021-08-03 11:59:44.123456')

DuckDB function yearweek

Description

Extract the yearweek component from a date or timestamp.

Usage

yearweek(ts)

Arguments

ts

⁠DATE | INTERVAL | TIMESTAMP | TIMESTAMP WITH TIME ZONE⁠

Value

BIGINT

SQL examples

yearweek(timestamp '2021-08-03 11:59:44.123456')