Skip to main content

MAP_CONTAINS_KEY

Introduced or updated: v1.2.464

Determines whether the specified MAP contains the specified key.

Syntax

MAP_CONTAINS_KEY( <map>, <key> )

Arguments

ArgumentsDescription
<map>The map to be searched.
<key>The key to find.

Return Type

Boolean.

Examples

SELECT MAP_CONTAINS_KEY({'a':1,'b':2,'c':3}, 'c');
┌────────────────────────────────────────────┐
│ map_contains_key({'a':1,'b':2,'c':3}, 'c')
├────────────────────────────────────────────┤
true
└────────────────────────────────────────────┘

SELECT MAP_CONTAINS_KEY({'a':1,'b':2,'c':3}, 'x');
┌────────────────────────────────────────────┐
│ map_contains_key({'a':1,'b':2,'c':3}, 'x')
├────────────────────────────────────────────┤
false
└────────────────────────────────────────────┘
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