---
title: Table properties and table options
description: Set user-defined tags and options on tables and views with table properties in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties
---

# Table properties and table options

**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

Defines user defined tags for tables and views.

* **[table properties](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md#tblproperties)**

  A table property is a key-value pair which you can initialize when you perform a [CREATE TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table.md) or a [CREATE VIEW](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-view.md).
  You can [UNSET](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md#unset-tblproperties) existing or [SET](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md#set-tblproperties) new or existing table properties using [ALTER TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.md) or [ALTER VIEW](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-view.md).

  You can use table properties to tag tables with information not tracked by SQL.

* **[table options](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md#options)**

  The purpose of table options is to pass storage properties to the underlying storage, such as SERDE properties to Hive.

  A table option is a key-value pair which you can initialize when you perform a [CREATE TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table.md).
  You cannot `SET` or `UNSET` a table option.

## TBLPROPERTIES

Sets one or more table properties in a new table or view.

You can use table properties to tag tables with information not tracked by SQL.

### Syntax

```
TBLPROPERTIES ( { property_key [ = ] property_val } [, ...] )

property_key
  { identifier [. ...] | string_literal }
```

### Parameters

* **property\_key**

  The property key. The key can consist of one or more [identifiers](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-identifiers.md) separated by a dot, or a string literal.

  Property keys must be unique and are case sensitive.

* **property\_val**

  The value for the property. The value must be a `BOOLEAN`, `STRING`, `INTEGER`, or `DECIMAL` literal.

### Examples

```sql
-- Create table with user defined table properties
> CREATE TABLE T(c1 INT) TBLPROPERTIES('this.is.my.key' = 12, this.is.my.key2 = true);
> SHOW TBLPROPERTIES T;
key              value
---------------- -----
...
this.is.my.key      12
this.is.my.key2   true
...
```

## SET TBLPROPERTIES

Sets one or more table properties in an existing table or view.

### Syntax

```
SET TBLPROPERTIES ( { property_key [ = ] property_val } [, ...] )

property_key
  { identifier [. ...] | string_literal }
```

### Parameters

* **property\_key**

  The property key. The key can consist of one or more [identifiers](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-identifiers.md) separated by a dot, or a string literal.

  Property keys must be unique and are case sensitive.

* **property\_val**

  The new value for the property. The value must be a `BOOLEAN`, `STRING`, `INTEGER`, or `DECIMAL` literal.

### Examples

```sql
-- Alter the a table's table properties.
>  ALTER TABLE T SET TBLPROPERTIES(this.is.my.key = 14, 'this.is.my.key2' = false);
> SHOW TBLPROPERTIES T;
key              value
---------------- -----
...
this.is.my.key      14
this.is.my.key2  false
...
```

## UNSET TBLPROPERTIES

Removes one or more table properties from a table or view.

### Syntax

```
UNSET TBLPROPERTIES [ IF EXISTS ] ( property_key [, ...] )

property_key
  { identifier [. ...] | string_literal }
```

### Parameters

* **IF EXISTS**

  An optional clause directing Databricks SQL not to raise an error if any of the property keys do not exist.

* **property\_key**

  The property key to remove. The key can consist of one or more [identifiers](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-identifiers.md) separated by a dot, or a string literal.

  Property keys are case sensitive. If `property_key` doesn't exist and error is raised unless `IF EXISTS` has been specified.

### Examples

```sql
-- Remove a table's table properties.
>  ALTER TABLE T UNSET TBLPROPERTIES(this.is.my.key, 'this.is.my.key2');
> SHOW TBLPROPERTIES T;
key                              value
-------------------------------- -----
... keys other that key and key2 ...
```

## OPTIONS

Sets one or more table options in a new table.

The purpose of table options is to pass storage properties to the underlying storage, such as SERDE properties to Hive.

Specifying table options for Delta Lake tables will also echo these options as table properties.

### Syntax

```
OPTIONS ( { property_key [ = ] property_val } [, ...] )

property_key
  { identifier [. ...] | string_literal }
```

### Parameters

* **property\_key**

  The property key. The key can consist of one or more [identifiers](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-identifiers.md) separated by a dot, or a string literal.

  Property keys must be unique and are case-sensitive.

* **property\_val**

  The value for the property. The value must be a `BOOLEAN`, `STRING`, `INTEGER`, or `DECIMAL` literal.

  In Databricks SQL and Databricks Runtime 13.3 LTS and above `property_val` can be a [constant expression](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-expression.md#constant-expression).

### Examples

```sql
-- Create table with user defined table option
-- The options appears with an `option.` prefix.
> CREATE TABLE T(c1 INT) OPTIONS(this.is.my.key = 'blue' || 'green');
> SHOW TBLPROPERTIES T;
key              value
---------------- -----
...
option.this.is.my.key bluegreen
...
```

## Reserved table property keys

Databricks reserves some property keys for its own use and raises an error if you attempt to use them:

* **`external`**

  Use [CREATE EXTERNAL TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-using.md) to create an external table.

* **`location`**

  Use the `LOCATION` clauses of [ALTER TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.md) and [CREATE TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table.md) to set a table location.

* **`owner`**

  Use the `[SET] OWNER TO` clause of [ALTER TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.md) and [ALTER VIEW](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-view.md) to transfer ownership of a table or view. SET is allowed as an optional keyword in Databricks SQL.

* **`provider`**

  Use the `USING` clause of [CREATE TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-using.md) to set the data source of a table

You should not use property keys starting with the `option` identifier.
This prefix identifier will be filtered out in [SHOW TBLPROPERTIES](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-aux-show-tblproperties.md).
The `option` prefix is also used to display [table options](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md#options).

## Common TBLPROPERTIES and OPTIONS keys

### Delta and Iceberg table properties

The following settings are commonly used with Delta Lake and Apache Iceberg tables:

* **`delta.appendOnly`**: Set to `true` to disable `UPDATE` and `DELETE` operations.
* **`delta.dataSkippingNumIndexedCols`**: Set to the number of leading columns for which to collect and consider statistics.
* **`delta.deletedFileRetentionDuration`**: Set to an interval such as `'interval 7 days'` to control when `VACUUM` is allowed to delete files.
* **`delta.logRetentionDuration`**: Set to an interval such as `'interval 60 days'` to control how long history is kept for time travel queries.

For the complete list of available Delta Lake and Apache Iceberg table properties, including descriptions, data types, and default values, see [Table properties reference](https://docs.databricks.com/aws/en/tables/table-properties.md).

### File format OPTIONS

When creating a table with a non-Delta Lake data source using [CREATE TABLE USING](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-using.md), you can use `OPTIONS` to pass file format-specific storage properties. The available option keys depend on the file format (`CSV`, `JSON`, `PARQUET`, `AVRO`, `ORC`, `TEXT`, `XML`, `BINARYFILE`). For details on the available options for each file format, see [`read_files` table-valued function](https://docs.databricks.com/aws/en/sql/language-manual/functions/read_files.md).

## Related articles

* [Table properties reference](https://docs.databricks.com/aws/en/tables/table-properties.md)
* [CREATE TABLE \[USING\]](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-using.md)
* [CREATE TABLE CLONE](https://docs.databricks.com/aws/en/sql/language-manual/delta-clone.md)
* [DROP TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-drop-table.md)
* [ALTER TABLE](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-alter-table.md)
