> ## Documentation Index
> Fetch the complete documentation index at: https://docs.firebolt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Statements

> Spark SQL and Databricks SQL DDL, DML, transaction, and access control statements supported in SparkSQL and Databricks compatibility modes.

Preview

Spark [data definition](https://spark.apache.org/docs/latest/sql-ref-syntax.html#ddl-statements) (DDL), [data manipulation](https://spark.apache.org/docs/latest/sql-ref-syntax.html#dml-statements) (DML), and [auxiliary](https://spark.apache.org/docs/latest/sql-ref-syntax.html#auxiliary-statements) statements in [SparkSQL and Databricks compatibility modes](https://docs.firebolt.io/reference-sql/spark/overview.md). Both modes accept everything listed here unless a row names one mode.

## Data definition language

| Statement | Support | Notes |
| :- | :- | :- |
| [`CREATE TABLE`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-create-table.html) | With limitations | Column-definition and `AS SELECT` forms, with `IF NOT EXISTS`, `OR REPLACE`, `NOT NULL`, and `DEFAULT`. `PARTITIONED BY (col, ...)` partitions the table by those columns, as Firebolt's `PARTITION BY`; a typed entry, such as `PARTITIONED BY (d DATE)`, is not supported, so declare the column in the column list. `TBLPROPERTIES` and `COMMENT` are accepted and ignored. Generated columns are supported and identity columns are not; see [Data types](https://docs.firebolt.io/reference-sql/spark/data-types.md#column-definitions). `CLUSTER BY`, `CLUSTERED BY ... INTO n BUCKETS`, and `LIKE` are not supported. |
| `CREATE TABLE ... USING <format>` | SparkSQL mode only | The format, including `DELTA` and `PARQUET`, is ignored: the table is a Firebolt table. |
| [`CREATE VIEW`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-create-view.html) | With limitations | `OR REPLACE`. `TEMPORARY` and `GLOBAL TEMPORARY` views are not supported, because a Firebolt view is permanent and visible to every session. Use `CREATE VIEW` or a `WITH` clause. |
| [`ALTER TABLE`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-alter-table.html) | With limitations | `ADD COLUMN`, `DROP COLUMN`, `RENAME COLUMN`, and `RENAME TO`. Not supported: `ADD COLUMNS (...)`, `ALTER COLUMN ... TYPE`, and `SET TBLPROPERTIES`. |
| [`ALTER VIEW`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-alter-view.html) | Not supported | |
| [`DROP TABLE`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-drop-table.html), [`DROP VIEW`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-drop-view.html) | Supported | `IF EXISTS`. |
| [`CREATE SCHEMA`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-create-database.html), `DROP SCHEMA` | Supported | `IF NOT EXISTS` and `IF EXISTS`. |
| `CREATE DATABASE`, `DROP DATABASE` | With limitations | Creates or drops a Firebolt database, not a schema. In Spark, `DATABASE` is a synonym for `SCHEMA`; use `CREATE SCHEMA` for that meaning. |
| `CREATE CATALOG` | Not supported | |
| [`TRUNCATE TABLE`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-truncate-table.html) | Supported | |
| [`USE`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-usedb.html) | With limitations | `USE db` switches the current Firebolt database. `USE DATABASE db` works in Databricks mode only. `USE SCHEMA` and `USE CATALOG` are not supported. |
| [`CREATE FUNCTION`](https://spark.apache.org/docs/latest/sql-ref-syntax-ddl-create-function.html), `DECLARE VARIABLE` | Not supported | |
| [`COMMENT ON`](https://docs.databricks.com/aws/en/sql/language-manual/sql-ref-syntax-ddl-comment) | Not supported | |
| [`OPTIMIZE`](https://docs.databricks.com/aws/en/sql/language-manual/delta-optimize) | Not supported | Databricks mode rejects it with an explanatory error. |
| `VACUUM t` | With limitations | Runs Firebolt's [`VACUUM`](https://docs.firebolt.io/reference-sql/commands/data-management/vacuum), which compacts the table's storage. It does not remove old files the way Delta's `VACUUM` does, and its options are not accepted. |

## Data manipulation language

| Statement | Support | Notes |
| :- | :- | :- |
| [`INSERT INTO`](https://spark.apache.org/docs/latest/sql-ref-syntax-dml-insert-table.html) | Supported | `VALUES` and `SELECT`, with a column list and the optional `TABLE` keyword. |
| [`INSERT OVERWRITE`](https://spark.apache.org/docs/latest/sql-ref-syntax-dml-insert-table.html), `INSERT ... REPLACE WHERE` | Not supported | |
| [`UPDATE`](https://docs.databricks.com/aws/en/sql/language-manual/delta-update) | Supported | |
| [`DELETE`](https://docs.databricks.com/aws/en/sql/language-manual/delta-delete-from) | Supported | |
| [`MERGE INTO`](https://docs.databricks.com/aws/en/sql/language-manual/delta-merge-into) | Supported | `WHEN MATCHED THEN UPDATE`/`DELETE`, `WHEN NOT MATCHED THEN INSERT`, and `WHEN NOT MATCHED BY SOURCE`. |
| [`COPY INTO`](https://docs.databricks.com/aws/en/sql/language-manual/delta-copy-into), [`LOAD DATA`](https://spark.apache.org/docs/latest/sql-ref-syntax-dml-load.html) | Not supported | Load data with Firebolt's [`COPY FROM`](https://docs.firebolt.io/reference-sql/commands/data-management/copy-from) in native SQL. |

## Auxiliary statements

| Statement | Support | Notes |
| :- | :- | :- |
| [`SHOW TABLES`](https://spark.apache.org/docs/latest/sql-ref-syntax-aux-show-tables.html), `SHOW VIEWS`, `SHOW DATABASES`, `SHOW COLUMNS` | With limitations | The columns follow Firebolt's `SHOW`, not Spark's. A `LIKE` pattern is not supported. |
| `SHOW SCHEMAS`, `SHOW CATALOGS`, `SHOW FUNCTIONS` | Not supported | |
| [`DESCRIBE`](https://spark.apache.org/docs/latest/sql-ref-syntax-aux-describe-table.html) | With limitations | `DESCRIBE t`, `DESCRIBE TABLE t`, and `DESCRIBE EXTENDED t` return the column listing in Firebolt's shape. `DESCRIBE FUNCTION`, `DESCRIBE QUERY`, `DESCRIBE DETAIL`, and `DESCRIBE HISTORY` are not supported. |
| [`EXPLAIN`](https://spark.apache.org/docs/latest/sql-ref-syntax-qry-explain.html) | Supported | Returns Firebolt's plan. |
| [`SET`](https://spark.apache.org/docs/latest/sql-ref-syntax-aux-conf-mgmt-set.html), `SET TIME ZONE`, `RESET` | Not supported | A Spark setting such as `spark.sql.session.timeZone` cannot be changed. Pass Firebolt settings, such as [`timezone`](https://docs.firebolt.io/reference-sql/system-settings#setting-the-time-zone), as query parameters. |
| `ANALYZE TABLE`, `SHOW CREATE TABLE` | Accepted and ignored | The statement returns no rows and changes nothing. |
| `CACHE TABLE`, `UNCACHE TABLE`, `REFRESH TABLE`, `MSCK REPAIR TABLE` | Not supported | |

## Transaction control

| Statement | Support | Notes |
| :- | :- | :- |
| `BEGIN`, `START TRANSACTION` | Supported | |
| `COMMIT` | Supported | |
| `ROLLBACK` | Supported | |

## Data control language

| Statement | Support | Notes |
| :- | :- | :- |
| [`GRANT`](https://docs.databricks.com/aws/en/sql/language-manual/security-grant), [`REVOKE`](https://docs.databricks.com/aws/en/sql/language-manual/security-revoke) | With limitations | The principal is read as a Firebolt [role](https://docs.firebolt.io/reference-sql/commands/access-control/create-role.md), so grant to a role, not to a user or group. |
| `CREATE ROLE` | Supported | Creates a Firebolt role. |

## Limitations

* DML returns no result set. Databricks returns the affected-row counts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.