Skip to main content

TO_DECADES

Introduced or updated: v1.2.677

Converts a specified number of decades into an Interval type.

  • Accepts positive integers, zero, and negative integers as input.

Syntax​

TO_DECADES(<decades>)

Return Type​

Interval (represented in years).

Examples​

SELECT TO_DECADES(2), TO_DECADES(0), TO_DECADES((- 2));

┌─────────────────────────────────────────────────┐
│ to_decades(2) │ to_decades(0) │ to_decades(- 2) │
├───────────────┼───────────────┼─────────────────┤
│ 20 years │ 00:00:00 │ -20 years │
└─────────────────────────────────────────────────┘
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