Using the Worksheet to Execute Queries & Perform DDL / DML

The Worksheet provides a powerful interface for creating and submitting SQL queries, as well as performing DDL and DML operations, and viewing the results side-by-side as your queries/operations complete.


The query details and results displayed in the worksheet are only maintained for your current user session. If you log out of the web interface and log back in, the results from your previous session are no longer displayed in the worksheet; however, you can use the History page to see queries you executed in previous sessions.

In this Topic:

Overview of Features

Worksheet page in the Snowflake web interface

Worksheets are designed to meet your business and workflow needs:

  • Run ad hoc queries and other DDL/DML operations.

  • Open up to six concurrent worksheets, each with its own separate session, allowing you to run queries in different worksheets without any degradation in UI performance.

  • Save a worksheet for later use.

  • Open a worksheet from your library of saved worksheets.


    • Saved worksheets are not accessible outside of the Snowflake web interface.
    • Saved worksheets cannot currently be shared with other users.
  • Load SQL script files from your workstation or network into a worksheet. After you’ve loaded a script file, you can optionally edit and save it to your library of saved worksheets.

  • Log out without losing your work. Snowflake retains the static contents of each worksheet, so you can log in again later and resume working where you left off. Snowflake displays the worksheets that were open when you logged out.


    The worksheet does not retain your current work if you close the browser tab without first logging out of Snowflake.

  • Specify a different role for each worksheet and switch roles without losing your work. You can execute specific statements in a worksheet, then switch roles before continuing your work in the same worksheet.


    Your current interface role dictates the default role for worksheets that you open, but the worksheets are not tied to the interface role. Each worksheet has it’s own role that can be set independently.

  • Log into Snowflake in another browser or tab. Any worksheet changes you made in one Snowflake instance persist to the other instance after a minute or two. You can continue working in the other browser (or tab) without re-entering your work.

  • Refresh your browser, if necessary. If you’re in the middle of running queries, they will resume running when the refresh is completed. Note that if you log out of Snowflake, any active queries stop running.

You can also perform other tasks on this page, including:

  • Resize the current warehouse to dynamically increase or decrease the compute resources utilized for executing your queries and DML statements.
  • Export the result for a selected query/statement (if the result is still available). For more information, see Exporting Query Results.

Executing Queries

Execute queries in a worksheet using any of the following options:

Single query (with no confirmation):

Place your cursor anywhere within a query without highlighting it, and click the Execute button to execute the query.

You can also execute a single query by placing the cursor anywhere in the query and typing the following key combination:

Single/multiple queries (with confirmation):

Highlight one or more queries, and click the Execute button. Snowflake displays a confirmation dialog, allowing you to decide whether or not to execute the queries.

All queries (with no confirmation):

Click the Execute All button. Snowflake executes all queries in the worksheet without displaying a confirmation dialog.

Formatting Queries Using Keyboard Shortcuts

Worksheets support the following keyboard keys and key combinations for formatting your queries and other SQL statements:

Tab Stops:

To insert a tab stop in a line (in 4 character intervals), use the [TAB] key:

  • If the cursor is at the beginning of the line, 4 blank spaces are inserted.
  • If the cursor is in the line, enough blank spaces are added to reach the next tab stop.

To indent/outdent a line (or multiple lines) 2 blank spaces, place the cursor anywhere in the line (or highlight the desired lines), hold down the [CMD] (Mac) or [CTRL] (Windows) key and type:

  • One or more right square brackets, ] , to indent the line(s) the number of brackets typed.
  • One or more left square brackets, [ , to outdent the line(s) the number of brackets typed.

If a line is indented, all new lines after the indented line are automatically indented the same number of blank spaces.


To comment out a line (or multiple lines), place the cursor anywhere in the line (or highlight the desired lines), hold down the [CMD] (Mac) or [CTRL] (Windows) key and type a forward slash, /.

Add Multiple Cursors:

To add multiple cursors in the same worksheet, hold down the [CMD] (Mac) or [CTRL] (Windows) key and click in each new location using the mouse left button or the touchpad.

Select Text Area:

To select a text area, hold down the [OPTION] (Mac) or [ALT] (Windows) key. The cursor turns into a crosshair. Cick and drag using the mouse left button or the touchpad.