---
title: CREATE TABLE LIKE
description: Create a table from the definition and metadata of an existing table with CREATE TABLE LIKE in Databricks SQL and Databricks Runtime.
canonical_url: https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-like
---

# CREATE TABLE LIKE

**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 a table using the definition and metadata of an existing table.

Delta Lake does support `CREATE TABLE LIKE` in Databricks SQL and Databricks Runtime 13.3 LTS and above.
In Databricks Runtime 12.2 LTS and below, use [CREATE TABLE AS](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-create-table-using.md#as).

## Syntax

```
CREATE TABLE [ IF NOT EXISTS ] table_name LIKE source_table_name [table_clauses]

table_clauses
   { USING data_source |
     LOCATION path |
     TBLPROPERTIES clause |
     ROW FORMAT row_format |
     STORED AS file_format } [...]

row_format
   { SERDE serde_class [ WITH SERDEPROPERTIES (serde_key = serde_val [, ...] ) ] |
     { DELIMITED [ FIELDS TERMINATED BY fields_terminated_char [ ESCAPED BY escaped_char ] ]
       [ COLLECTION ITEMS TERMINATED BY collection_items_terminated_char ]
       [ MAP KEYS TERMINATED BY map_key_terminated_char ]
       [ LINES TERMINATED BY row_terminated_char ]
       [ NULL DEFINED AS null_char ] } }

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

## Parameters

* **IF NOT EXISTS**

  If specified ignores the statement if the `table_name` already exists.

* **[table\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-name)**

  The name of the table to create. The name must not include a [temporal specification or options specification](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-name).
  If the name is not qualified the table is created in the current schema.
  A table\_name must not exist already.

* **[source\_table\_name](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-names.md#table-name)**

  The name of the table whose definition is copied.
  `source_table_name` and `table_name` must both be on Hive metastore, or both be on Unity Catalog.

* **table\_clauses**

  Optionally specify a data source format, location, and user defined properties for the new table.
  Each sub clause may only be specified once.

  * **LOCATION path**

    Path to the directory where table data is stored, which could be a path on distributed storage.
    If you specify a location, the new table becomes an [external table](https://docs.databricks.com/aws/en/tables/external.md).
    If you do not specify a location, the table is a [managed table](https://docs.databricks.com/aws/en/tables/managed.md).

    You cannot create external tables in locations that overlap with the location of managed tables.

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

    Optionally sets one or more user defined properties.

  * **USING data\_source**

    The file format to use for the table. `data_source` must be one of:

    * `TEXT`
    * `CSV`
    * `JSON`
    * `JDBC`
    * `PARQUET`
    * `DELTA`

    The following additional file formats to use for the table are supported in Databricks Runtime:

    * `ORC`
    * `HIVE`
    * `LIBSVM`
    * a fully-qualified class name of a custom implementation of `org.apache.spark.sql.sources.DataSourceRegister`.

    If you do not specify `USING` the format of the source table will be inherited.

    **The following applies to:** Databricks Runtime

    `HIVE` is supported to create a Hive SerDe table in Databricks Runtime.
    You can specify the Hive-specific `file_format` and `row_format` using the `OPTIONS` clause, which is a case-insensitive string map.
    The `option_keys` are:

    * `FILEFORMAT`
    * `INPUTFORMAT`
    * `OUTPUTFORMAT`
    * `SERDE`
    * `FIELDDELIM`
    * `ESCAPEDELIM`
    * `MAPKEYDELIM`
    * `LINEDELIM`

  * **ROW FORMAT row\_format**

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

    To specify a custom SerDe, set to `SERDE` and specify the fully-qualified class name of a custom SerDe and optional SerDe properties. To use the native SerDe, set to `DELIMITED` and specify the delimiter, escape character, null character and so on.

    * **SERDEPROPERTIES**

      A list of key-value pairs used to tag the SerDe definition.

    * **FIELDS TERMINATED BY**

      Define a column separator.

    * **ESCAPED BY**

      Define the escape mechanism.

    * **COLLECTION ITEMS TERMINATED BY**

      Define a collection item separator.

    * **MAP KEYS TERMINATED BY**

      Define a map key separator.

    * **LINES TERMINATED BY**

      Define a row separator.

    * **NULL DEFINED AS**

      Define the specific value for `NULL`.

    * **STORED AS**

      The file format for the table. Available formats include `TEXTFILE`, `SEQUENCEFILE`, `RCFILE`, `ORC`, `PARQUET`, and `AVRO`. Alternatively, you can specify your own input and output formats through `INPUTFORMAT` and `OUTPUTFORMAT`. Only formats `TEXTFILE`, `SEQUENCEFILE`, and `RCFILE` can be used with `ROW FORMAT SERDE` and only `TEXTFILE` can be used with `ROW FORMAT DELIMITED`.

## Notes

Depending on the data source and target not all properties of tables may be transferred.

`CREATE TABLE LIKE` when the **source** is a Delta Lake Table:

| Feature/Property  | Target is non-Delta Table | Target is a Delta Table |
| ----------------- | ------------------------- | ----------------------- |
| COMMENT           | Yes                       | Yes                     |
| Columns           | Yes                       | Yes                     |
| Partition columns | Yes                       | Yes                     |
| Configuration     | No                        | Yes                     |
| Table Constraint  | Not Applicable            | Yes                     |
| Delta Protocol    | Not Applicable            | Yes                     |
| Row filters       | No                        | No                      |
| Column masks      | No                        | No                      |
| Governed tags     | No                        | No                      |

`CREATE TABLE LIKE` when the **source** is not a Delta Lake Table:

| Feature/Property  | Target is non-Delta Table                      | Target is a Delta Table |
| ----------------- | ---------------------------------------------- | ----------------------- |
| COMMENT           | Yes                                            | Yes                     |
| Columns           | Yes                                            | Yes                     |
| Partition columns | Yes                                            | Yes                     |
| Configuration     | Yes                                            | Yes                     |
| Table Constraint  | No                                             | Yes                     |
| Delta Protocol    | No (Current Default Protocol for that session) | Yes                     |
| Row filters       | No                                             | No                      |
| Column masks      | No                                             | No                      |
| Governed tags     | No                                             | No                      |

> [!IMPORTANT]
>
> `CREATE TABLE LIKE` does not carry over access controls from the source table. It only creates a new table with the same schema and table metadata as the source table.
>
> The following access controls are not carried over to the new table:
>
> * Table-level [row filters](https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/index.md) and [column masks](https://docs.databricks.com/aws/en/data-governance/unity-catalog/filters-and-masks/index.md) on the source table.
> * [Governed tags](https://docs.databricks.com/aws/en/admin/governed-tags/index.md) assigned to the source table or its columns. Because [attribute-based access control (ABAC)](https://docs.databricks.com/aws/en/data-governance/unity-catalog/abac/index.md) policies match tables and columns based on governed tags, ABAC policies that match the source table or its columns do not automatically match the new table unless you add the required governed tags to the new table.
>
> After you create the new table, add any required row filters, column masks, and governed tags.

## Examples

```sql
-- Create table using a new location
> CREATE TABLE Student_Dupli LIKE Student LOCATION '/path/to/data_files';

-- Create table like using a data source
> CREATE TABLE Student_Dupli LIKE Student USING CSV LOCATION '/path/to/csv_files';
```

## Related articles

* [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)
* [Table properties](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-tblproperties.md)
