Del via


CREATE TABLE

Defines a table in an existing schema.

You can use any of the following different means to create a table for different purposes:

  • CREATE TABLE [USING]

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

    Use this syntax if the new table will be:

    • Based on a column definition you provide.
    • Derived from data at an existing storage location.
    • Derived from a query.
  • CREATE TABLE (Hive format)

    Applies to: check marked yes Databricks Runtime

    This statement matches CREATE TABLE [USING] using Hive syntax.

    CREATE TABLE [USING] is preferred.

  • CREATE TABLE LIKE

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

    Using this syntax you create a new table based on the definition, but not the data, of another table.

  • CREATE TABLE CLONE

    Applies to: check marked yes Databricks SQL check marked yes Databricks Runtime

    You can use table cloning for Delta Lake tables to achieve two major goals:

    • Make a complete, independent copy of a table including its definition and data at a specific version. This is called a DEEP CLONE.
    • Make a copy of the definition of the table which refers to the original table’s storage for the initial data at a specific version. Updates, on either the source or the new table will not affect the other. However the new table depends on the source table’s existence and column definition.