CockroachDB supports the following SQL statements. Click a statement for more details.

Statement Usage
ADD COLUMN Add columns to a table.
ADD CONSTRAINT Add a constraint to a column.
ALTER COLUMN Change a column’s Default constraint or drop the Not Null constraint.
ALTER TABLE Apply a schema change to a table.
ALTER VIEW Rename a view.
BEGIN Initiate a transaction.
COMMIT Commit the current transaction.
CREATE DATABASE Create a new database.
CREATE INDEX Create an index for a table.
CREATE TABLE Create a new table in a database.
CREATE TABLE AS Create a new table in a database using the results from a SELECT statement.
CREATE USER Creates a SQL user, which lets you control privileges on your databases and tables.
CREATE VIEW Create a new view in a database.
DELETE Delete specific rows from a table.
DROP COLUMN Remove columns from a table.
DROP CONSTRAINT Remove constraints from a column.
DROP DATABASE Remove a database and all its objects.
DROP INDEX Remove an index for a table.
DROP TABLE Remove a table.
DROP VIEW Remove a view.
EXPLAIN View debugging and analysis details for a SELECT, INSERT, UPDATE, or DELETE statement.
GRANT Grant privileges to users.
INSERT Insert rows into a table.
RENAME COLUMN Rename a column in a table.
RENAME DATABASE Rename a database.
RENAME INDEX Rename an index for a table.
RENAME TABLE Rename a table or move a table between databases.
RELEASE SAVEPOINT When using the CockroachDB-provided function for client-side transaction retries, commit the transaction’s changes once there are no retryable errors.
REVOKE Revoke privileges from users.
ROLLBACK Discard all updates made by the current transaction or, when using the CockroachDB-provided function for client-side transaction retries, rollback to the cockroach_restart savepoint and retry the transaction.
SELECT Select rows from a table.
SET DATABASE Set the default database for the session.
SET TIME ZONE Set the default time zone for the session.
SET TRANSACTION Set the isolation level or priority for the session or for an individual transaction.
SHOW ALL List all current run-time settings.
SHOW COLUMNS View details about columns in a table.
SHOW CONSTRAINTS List constraints on a table.
SHOW CREATE TABLE View the CREATE TABLE statement that would create a carbon copy of the specified table.
SHOW CREATE VIEW View the CREATE VIEW statement that would create a carbon copy of the specified view.
SHOW DATABASE List the default database for the session.
SHOW DATABASES List databases in the cluster.
SHOW GRANTS View privileges granted to users.
SHOW INDEX View index information for a table.
SHOW TABLES List tables in a database.
SHOW TIME ZONE View the default time zone for the session.
SHOW TRANSACTION View the isolation level or priority for the session or for an individual transaction.
SHOW USERS Lists the users for all databases.
TRUNCATE Deletes all rows from specified tables.
UPDATE Update rows in a table.
UPSERT Insert rows that do not violate uniqueness constraints; update rows that do.


Yes No