---
title: map_concat function
description: Learn the syntax of the map\_concat function of the SQL language in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/map_concat
---

# `map_concat` function

**Applies to:** ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks SQL ![check marked yes](https://docs.databricks.com/aws/en/images/icons/check.png) Databricks Runtime

Returns the union of all `expr` map expressions.

## Syntax

```
map_concat([ expr1 [, ...] ])
```

## Arguments

* `exprN`: A MAP expression. All `exprN` must share a least common type.

## Returns

A MAP of the least common type of `exprN`.

If no argument is provided, an empty map.

Databricks raises [DUPLICATED\_MAP\_KEY](https://docs.databricks.com/aws/en/error-messages/error-classes.md#duplicated_map_key) if there is a key collision across input maps.

## Common error conditions

* [DUPLICATED\_MAP\_KEY](https://docs.databricks.com/aws/en/error-messages/error-classes.md#duplicated_map_key)

## Examples

```sql
> SELECT map_concat(map(1, 'a', 2, 'b'), map(3, 'c'));
  {1 -> a, 2 -> b, 3 -> c}

> SELECT map_concat(map(1, 'a'), map(1, 'b'));
  Error: DUPLICATED_MAP_KEY
```

## Related

* [`map` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map.md)
* [`map_entries` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_entries.md)
* [`map_filter` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_filter.md)
* [`map_from_arrays` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_from_arrays.md)
* [`map_from_entries` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_from_entries.md)
* [`map_keys` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_keys.md)
* [`map_values` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_values.md)
* [`map_zip_with` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map_zip_with.md)
* [SQL data type rules](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-datatype-rules.md)
