---
title: named_struct function
description: Learn the syntax of the named\_struct function of the SQL language in Databricks.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/functions/named_struct
---

# `named_struct` 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

Creates a struct with the specified field names and values.

## Syntax

```
named_struct( {name1, val1} [, ...] )
```

## Arguments

* `nameN`: A STRING literal naming field N.
* `valN`: An expression of any type specifying the value for field N.

## Returns

A struct with field N matching the type of `valN`.

## Examples

```sql
> SELECT named_struct('a', 1, 'b', 2, 'c', 3);
 {"a":1,"b":2,"c":3}
```

## Related functions

* [`struct` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/struct.md)
* [`map` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/map.md)
* [`str_to_map` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/str_to_map.md)
* [`array` function](https://docs.databricks.com/aws/en/sql/language-manual/functions/array.md)
