SQL Function Reference | Databend
Skip to main content

SQL Function Reference

Databend provides comprehensive SQL functions for all types of data processing. Functions are organized by importance and usage frequency.

tip

Can't find the function you need? If none of the built-in functions below cover your logic, you can define your own with User-Defined Functions (UDFs). UDFs let you implement custom scalar, aggregate, and table functions using SQL expressions, Python, or JavaScript, then call them just like any built-in function. See Extending with User-Defined Functions below.

Core Data Functions

CategoryDescription
Numeric FunctionsMathematical operations and calculations
String FunctionsText manipulation and string processing
Date & Time FunctionsDate, time, and temporal operations
Conversion FunctionsType casting and data format conversions
Conditional FunctionsLogic and control flow operations

Analytics Functions

CategoryDescription
Aggregate FunctionsStatistical calculations across multiple rows
Window FunctionsAdvanced analytics with window operations

Structured & Semi-Structured Data

CategoryDescription
Structured & Semi-Structured FunctionsJSON, arrays, objects, and nested data processing

Search Functions

CategoryDescription
Full-Text Search FunctionsFull-text search and relevance scoring

Vector Functions

CategoryDescription
Vector FunctionsVector similarity and distance calculations

Geospatial Functions

CategoryDescription
Geospatial FunctionsGeometry, GeoHash, and H3 spatial operations

Data Management

CategoryDescription
Table FunctionsFile inspection, data generation, and system information
System FunctionsSystem information and management operations
Context FunctionsCurrent session, user, and database information

Security & Integrity

CategoryDescription
Hash FunctionsData hashing and integrity verification
Bitmap FunctionsHigh-performance bitmap operations and analytics
UUID FunctionsUniversally unique identifier generation
IP Address FunctionsNetwork address manipulation and validation

Utility Functions

CategoryDescription
Interval FunctionsTime unit conversion and interval creation
Sequence FunctionsAuto-incrementing sequence value generation
Data Anonymization FunctionsData masking and anonymization utilities
Test FunctionsTesting and debugging utilities
Other FunctionsMiscellaneous helpers and utilities

Extending with User-Defined Functions

When the built-in functions above don't cover your specific logic, define your own with User-Defined Functions (UDFs). Once created, a UDF is called exactly like a built-in function in your queries.

Function TypeUse It When
Scalar Function (SQL)You want to reuse a SQL expression across queries (math, string formatting).
Scalar Function (Python/JavaScript)Your logic needs control flow, external libraries, or advanced algorithms.
Aggregate FunctionYou need a custom aggregation that built-in aggregates can't express.
Table FunctionYou want a reusable, parameterized query that returns a result set.

For a full comparison of UDF types and syntax, see User-Defined Function.

Try Databend Cloud for FREE

Multimodal, object-storage-native warehouse for BI, vectors, search, and geo.

Snowflake-compatible SQL with automatic scaling.

Sign up and get $200 in credits.

Try it today