Limitations
- All statements in the SQL Shell are executed within a transaction, so you cannot use the SET CLUSTER SETTING statement to configure cluster settings.
- The SQL Shell does not yet support sessions.
- The SQL Shell is not available for CockroachDB Advanced clusters with additional security add-ons configured.
- The SQL Shell is available to CockroachDB Cloud users with the Cluster Admin role or the Cluster Data Accessor role.
- The SQL Shell does not support transaction control statements.
- The SQL Shell does not support the
CALLstatement used to invoke a stored procedure.
Overview
Above the SQL Shell input field, you will see the active user and cluster details in the format{user name} @ {cluster-name}:{active-database}. Note that the user displayed is the Team member currently logged into the Cloud Console, not the active SQL user, which is root. Team members without the Cluster Admin or Cluster Data Accessor role needed to access the Cloud Console SQL Shell can still access CockroachDB’s command line SQL shell.
You can change the active database in the dropdown menu above the input field. If you create a new database in the SQL Shell, you will have to reload the page to refresh the database dropdown menu. Reloading the page will also clear your activity.
To execute a SQL statement, enter it in the input field and either click Run or use the Enter key. The statement status will be Loading until it either Succeeds or returns an Error. Any results returned can be exported by clicking the Export results button below the executed statement.
You can select any statement that you’ve previously run and copy it, edit it, or re-run it.
Example workflow
The following examples assume you have already created a CockroachDB Cloud cluster and have access to the SQL Shell.-
In the SQL Shell, run
CREATE TABLEfollowed by a table name, the column names, and the data type and constraint, if any, for each column: -
Insert rows into the table using
INSERT INTOfollowed by the table name and then the column values listed in the order in which the columns appear in the table: -
Click the copy icon next to the successful
INSERT INTOstatement, paste it into the input field, edit the values, and run it again: -
Query the table with
SELECTfollowed by a comma-separated list of the columns to be returned and the table from which to retrieve the data: -
Edit the executed
SELECTstatement to replacenamewith the*wildcard symbol and click Run:Note that each line of a query’s results will be numbered independently of the output. This is for readability and will not be shown in any exported data. - Click Export results to download a CSV file of the output.

