SQL Statements

SQream supports commands from ANSI SQL.

Data Definition Commands (DDL)

Command

Usage

ADD COLUMN

Add a new column to a table

ALTER DEFAULT SCHEMA

Change the default schema for a role

ALTER TABLE

Change the schema of a table

CLUSTER BY

Change clustering keys in a table

CREATE DATABASE

Create a new database

CREATE FOREIGN TABLE

Create a new foreign table in the database

CREATE FUNCTION

Create a new user-defined function in the database

CREATE SCHEMA

Create a new schema in the database

CREATE TABLE

Create a new table in the database

CREATE TABLE AS

Create a new table in the database using results from a select query

CREATE VIEW

Create a new view in the database

DESCRIBE COLUMNS

Lists information about columns in an internal or external table

DESCRIBE CONFIGURATION

Shows all configurations set on the session level

DESCRIBE DATABASES

Lists information about the databases in your cluster

DESCRIBE POOLS

List all of your pools

DESCRIBE SCHEMAS

Lists information about schemas in your cluster

DESCRIBE TABLES

List information about tables in your database

DESCRIBE TABLES EXTENDED

Lists all the tables in your database

DESCRIBE USER FUNCTIONS

Lists all user-defined functions in your database

DESCRIBE VIEWS

Creates a list of database views

DROP CLUSTERING KEY

Drops all clustering keys in a table

DROP COLUMN

Drop a column from a table

DROP DATABASE

Drop a database and all of its objects

DROP FUNCTION

Drop a function

DROP SCHEMA

Drop a schema

DROP TABLE

Drop a table and its contents from a database

DROP VIEW

Drop a view

RENAME COLUMN

Rename a column

RENAME TABLE

Rename a table

USE DATABASE

Lets you shift between databases within an existing session

USE POOL

Lets you shift between pools within a session

USE SCHEMA

Lets you shift between schemes within an existing session

RENAME SCHEMA

Rename a schema

Data Manipulation Commands (DML)

Command

Usage

COPY FROM

Bulk load data into an existing table from different file formats

COPY TO

Export a select query or entire table to CSV files

DELETE

Delete specific rows from a table

INSERT

Inserts rows into a table

SELECT

Select rows and column from a table

TRUNCATE

Delete all rows from a table

UPDATE

Modify the value of certain columns in existing rows without creating a table

VALUES

Return rows containing literal values

Utility Commands

Command

Usage

ABORT

Performs a graceful stop, known as an abort, on an active statement

ANALYZE TABLE

This command generates statistics for an entire table or for a specific column within a table

AUDIT LOG

Returns system user activity

DESCRIBE LOCKS

Returns a list of locks from across your cluster

DESCRIBE SAVED QUERIES LIST

Lists of all of your saved queries

DESCRIBE SAVED QUERY

Returns the SQL syntax of a specific saved query

DESCRIBE SESSION QUERIES

Lists queries per session, including queued queries

DESCRIBE SESSIONS

Outputs information about your current session

DESCRIBE QUERY

Displays information about query execution

DROP SAVED QUERY

Drops a saved query

DROP STATISTICS FOR COLUMNS

This command terminates an ANALYZE TABLE execution

DUMP DATABASE DDL

View the CREATE TABLE statement for a current database

EXECUTE SAVED QUERY

Executes a previously saved query

EXPLAIN

Returns a static query plan, which can be used to debug query plans

FETCH COLUMN HISTOGRAM

This command displays the results of an ANALYZE TABLE operation

GET DDL

View the CREATE TABLE statement for a table

GET FUNCTION DDL

View the CREATE FUNCTION statement for a UDF

GET VIEW DDL

View the CREATE VIEW statement for a view

RECOMPILE_VIEW

Recreate a view after schema changes

RECOMPILE SAVED QUERY

Recompiles a saved query that has been invalidated due to a schema change

SAVE QUERY

Saves query execution plan

STATISTICS REQUEST ABORT

This command aborts an ANALYZE TABLE execution

STATISTICS REQUEST STATUS

This command returns information about your statistics collection request

Access Control Commands

The following table shows the Access Control commands:

Command

Usage

ALTER DEFAULT PERMISSIONS

Applies a change to defaults in the current schema

ALTER ROLE

Applies a change to an existing role

CREATE ROLE

Creates a role, which lets a database administrator control permissions on tables and databases

DESCRIBE CONNECT PERMISSIONS

Lists all roles and their database connection privileges

DESCRIBE ROLES

Lists all roles defined in your system

DESCRIBE ROLE PERMISSIONS

Lists all role privileges

DROP ROLE

Removes roles

GET_ROLE_PERMISSIONS

Returns all permissions granted to a role in table format

GET ROLE GLOBAL DDL

Returns the definition of a global role in DDL format

GET_ALL_ROLES_GLOBAL_DDL

Returns the definition of all global roles in DDL format

GET ROLE DATABASE DDL

Returns the definition of a role’s database in DDL format

GET_ALL_ROLES_DATABASE_DDL

Returns the definition of all role databases in DDL format

GET STATEMENT PERMISSIONS

Returns a list of permissions required to run a statement or query

GRANT

Grant permissions to a role

REVOKE

Revoke permissions from a role

RENAME ROLE

Rename a role