- Installation
- Guides
- Data Import & Export
- CSV Import
- CSV Export
- Parquet Import
- Parquet Export
- Query Parquet
- HTTP Parquet Import
- S3 Parquet Import
- S3 Parquet Export
- SQLite Import
- Postgres Import
- Meta Queries
- Python
- Install
- Execute SQL
- Jupyter Notebooks
- SQL on Pandas
- Import From Pandas
- Export To Pandas
- SQL on Arrow
- Import From Arrow
- Export To Arrow
- Relational API on Pandas
- DuckDB with Ibis
- DuckDB with Polars
- DuckDB with Vaex
- SQL Editors
- Data Viewers
- Documentation
- Connect
- Data Import
- Client APIs
- Overview
- Python
- R
- Java
- Julia
- C
- Overview
- Startup
- Configure
- Query
- Data Chunks
- Values
- Types
- Prepared Statements
- Appender
- Table Functions
- Replacement Scans
- API Reference
- C++
- Node.js
- WASM
- ODBC
- CLI
- SQL
- Introduction
- Statements
- Overview
- Select
- Insert
- Delete
- Update
- Create Schema
- Create Table
- Create View
- Create Sequence
- Create Macro
- Drop
- Alter Table
- Copy
- Export
- Query Syntax
- SELECT
- FROM
- WHERE
- GROUP BY
- GROUPING SETS
- HAVING
- ORDER BY
- LIMIT
- SAMPLE
- UNNEST
- WITH
- WINDOW
- QUALIFY
- VALUES
- FILTER
- Set Operations
- Data Types
- Expressions
- Functions
- Overview
- Enum Functions
- Numeric Functions
- Text Functions
- Pattern Matching
- Date Functions
- Timestamp Functions
- Timestamp With Time Zone Functions
- Time Functions
- Interval Functions
- Date Formats
- Date Parts
- Blob Functions
- Nested Functions
- Utility Functions
- Indexes
- Aggregates
- Window Functions
- Samples
- Information Schema
- Configuration
- Pragmas
- Extensions
- Development
- DuckDB Repositories
- Testing
- Internals Overview
- Storage Versions & Format
- Execution Format
- Profiling
- Release Dates
- Building
- Benchmark Suite
- Sitemap
- Why DuckDB
- Media
- FAQ
- Code of Conduct
- Live Demo
Enum Functions
Version 0.6.1
This section describes functions and operators for examining and manipulating ENUM
values.
The examples assume an enum type created as:
CREATE TYPE mood AS ENUM ('sad', 'ok', 'happy', 'anxious');
These functions can take NULL
or a specific value of the type as argument(s).
With the exception of enum_range_boundary
, the result depends only on the type of the argument and not on its value.
Function | Description | Example | Result |
---|---|---|---|
enum_first( enum ) |
Returns the first value of the input enum type. | enum_first(null::mood) |
sad |
enum_last( enum ) |
Returns the last value of the input enum type. | enum_last(null::mood) |
anxious |
enum_range( enum ) |
Returns all values of the input enum type as an array. | enum_range(null::mood) |
[sad, ok, happy, anxious] |
enum_range_boundary( enum , enum ) |
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. |
enum_range_boundary(NULL, 'happy'::mood) |
[sad, ok, happy] |
Search Shortcut cmd + k | ctrl + k