📣
TiDB Cloud Premium is now in public preview. Unlimited growth, instant elasticity, advanced security for enterprise workloads. Try it out →

MAP_PICK



Returns a new MAP containing the specified key-value pairs from an existing MAP.

Syntax

MAP_PICK( <map>, <key1> [, <key2>, ... ] ) MAP_PICK( <map>, <array> )

Arguments

ArgumentsDescription
<map>The input MAP.
<keyN>The KEYs to be included from the returned MAP.
<array>The Array of KEYs to be included from the returned MAP.

Return Type

Map.

Examples

SELECT MAP_PICK({'a':1,'b':2,'c':3}, 'a', 'c'); ┌─────────────────────────────────────────┐ │ map_pick({'a':1,'b':2,'c':3}, 'a', 'c') │ ├─────────────────────────────────────────┤ │ {'a':1,'c':3} │ └─────────────────────────────────────────┘ SELECT MAP_PICK({'a':1,'b':2,'c':3}, ['a', 'b']); ┌───────────────────────────────────────────┐ │ map_pick({'a':1,'b':2,'c':3}, ['a', 'b']) │ ├───────────────────────────────────────────┤ │ {'a':1,'b':2} │ └───────────────────────────────────────────┘

Was this page helpful?