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

# `schema_of_csv` 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 schema of a `CSV` string in `DDL` format.

## Syntax

```
schema_of_csv(csv [, options] )
```

## Arguments

* `csv`: A `STRING` literal with valid `CSV` data.
* `options`: An optional `MAP` literals where keys and values are `STRING`.

## Returns

A `STRING` composing a struct.
The field names are derived by position as `_Cn`.
The values hold the derived formatted SQL types.
For a complete list of options, see [CSV](https://docs.databricks.com/aws/en/spark/api-options.md#function-csv).

## Examples

```sql
> DESCRIBE SELECT schema_of_csv('1,abc');
 STRUCT<`_c0`: INT, `_c1`: STRING>
```

## Related functions

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