Skip to content

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

MAP_PICK( <map>, <key1> [, <key2>, ... ] )
MAP_PICK( <map>, <array> )
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.

Map.

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} │
└───────────────────────────────────────────┘