Using Worksheets for Queries / DML / DDL

The Worksheets Worksheet tab page of the Classic Console provides a powerful and versatile interface for creating and submitting SQL queries, as well as performing most other DML and all DDL operations, and viewing the results as your statements complete.


This topic provides details about Classic Console. If you’re using Snowsight, see Managing and using worksheets in Snowsight.

Overview of Features

Worksheet page in the Classic Console
  1. Object browser.

  2. Add a worksheet.

  3. Dropdown menu:

    • Manage worksheets (search for, open or delete, rename).

    • Open a tutorial.

    • Load a script.

  4. Dropdown menu:

    • Change the current database, schema, or warehouse for the current worksheet without losing your work.

    • Resume/suspend or resize your current warehouse.

  5. Dropdown menu:

    • Load a script.

    • Enable/disable text highlighting.

    • Show/hide Run confirmation.

    • Delete the current worksheet.

  6. SQL editor.

  7. Download Results.

  8. Copy results to clipboard.

  9. Maximize/restore results.

  10. Hide or show columns.

Worksheets are designed to meet all your business and workflow needs, including:

  • Running ad hoc queries and performing other SQL operations.

  • Opening multiple, concurrent worksheets, each with its own separate session, allowing you to run queries in different worksheets with different contexts without any degradation in UI performance.

  • Saving a worksheet for later use.

  • Opening a worksheet from your library of saved worksheets.


    • Saved worksheets are not accessible outside of the Classic Console.

    • Saved worksheets cannot currently be shared with other users.

  • Loading 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.

  • Logging 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.

    Note that resized/collapsed panes, width changes to the result/data preview columns, and even the cursor position in the SQL editor, are persisted:

    • When switching between open worksheets.

    • When closing and reopening the same worksheet.

    • Between user sessions.

  • Specifying a different role for each worksheet and switching 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 determines the default role for worksheets that you open, but the worksheets are not tied to the interface role. Each worksheet has its own role that can be set independently.

  • Logging 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.

  • Refreshing 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:

  • Resizing the current warehouse to dynamically increase or decrease the compute resources utilized for executing your queries and other DML statements.

  • Exporting the result for a selected query/statement (if the result is still available). For more information, see Exporting Query Results.

Saving and Managing Worksheets

Snowflake automatically saves worksheets as you type and persists the current state of a worksheet between user sessions. To organize your worksheets, double-click on the worksheet label in the tab (e.g. Worksheet 2) and type a new, more meaningful name for the worksheet (e.g. Sales Analysis).

To open a closed worksheet, click the down-arrow to the right of the open worksheet tabs, and click Open Worksheet. The Open Worksheet dialog opens.

Open Worksheet dialog in the worksheet page
  1. Search for worksheets by label.

  2. Delete selected worksheets.

  3. Click on a row to select a single worksheet.

    Click the CMD (Mac) or CTRL (Windows) key once and then click on multiple rows to select multiple worksheets.

  4. Double-click a label to edit it.

  5. Open selected worksheets.

The Open Worksheet dialog supports the following actions:



Search for individual worksheets by label.

Enter text in the Search field. The list of existing worksheets is filtered automatically.

Edit worksheet labels.

Double-click on a worksheet label, and edit the text. Worksheet labels are limited to 255 characters.

Open or delete one or more worksheets.

  1. Select a single worksheet by clicking on the table row for the worksheet.

    To select multiple worksheets, click the CMD (Mac) or CTRL (Windows) key once and then click on multiple table rows.

  2. Click on the Open button to open the worksheets in separate tabs, or click on the Delete button to delete the worksheets.

Using the Object Browser

Object browser in the worksheet page
  1. Preview table data.

  2. Double-click to insert name into SQL editor.

The object browser enables users to explore all databases, schemas, tables, and views accessible by the role selected for a worksheet.

The list of databases and other objects refreshes automatically when the worksheet context is changed. Users can also click the refresh button at the top of the object browser to view object changes immediately.

The object browser can be collapsed at any time to make more room for the SQL editor and results/history panes.

Exploring Database Objects

Click on a database or schema to explore the database objects contained within. You can then drill down to the table and view level.




Preview table/view data in the data preview pane

  • Click the desired table/view, or

  • Hover your mouse over the desired table/view and click:

    » Preview Data

  • Data previews are limited to the first 100 rows.

  • An active warehouse is required to preview data.

  • When the data for a view is previewed, a SQL Text button appears in the data preview pane. Click this button to see the SQL statement in the current view description.

Set a database or schema in the object browser as the context for the worksheet

  • Hover your mouse over the desired database/schema and click:

    » Set as Context

  • This is a shortcut to clicking on the Context bar in the upper right and selecting the database/schema from the dropdown menus.

Insert the fully-qualified name of a database or object into the SQL editor at the cursor position

  • Double-click the database or object, or

  • Hover your mouse over the database/object and click:

    » Place Name in SQL

Searching for Database Objects

Search for databases, schemas, tables, and views using the Find database objects field. Note that searches are “starts with” searches, and are also case-insensitive unless the search string is enclosed in double quotes.

You can also search within a database or schema using the search icon that appears for the item when you hover over it in the object browser.

Managing Warehouses

Click the context menu to select a different active warehouse for the worksheet. You can resume or suspend the selected warehouse, or resize the warehouse.

Warehouse controls in the context menu

Managing Queries


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 History tab page to see queries you executed in previous sessions.

Executing Queries

Execute queries in the SQL editor using any one of the following options:



Keyboard Shortcuts

Execute single query

  1. Place your cursor anywhere within a query (without selecting it).

  2. Click the Run button.

With your cursor anywhere in the query, type the following key combination:





Execute all queries

  1. Select the All Queries checkbox.

  2. Click the Run button.

N/A (None)

Execute single/multiple queries (with confirmation)

  1. Select one or more contiguous queries.

  2. Click the Run button. Snowflake displays a confirmation dialog, asking whether you wish to execute the selected queries.

N/A (None)

Execute all queries (with confirmation)

  1. Select all the queries.

  2. Click the Run button. Snowflake displays a confirmation dialog, asking whether you wish to execute the selected queries.

With no queries selected, type the following key combination:





Aborting Running Queries

While queries are running, the Run button changes to an Abort button. Click this button to abort the running queries.

Viewing Query Information and Details

When a query is executed, a status bar displays the current total query duration. Hover over the bar to see a breakdown of the duration.

Duration popup in the results pane
  1. Hover over to view query metrics.

Click the Query ID link to explore query details. A popover provides links to copy the query ID to your operating system’s temporary memory or to navigate to the query history.

Duration popup in the results pane
  1. Click to copy the query ID.

  2. Click to navigate to the query history.

Formatting Queries Using Keyboard Shortcuts

The SQL editor in a worksheet supports 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.

  • 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, /.

Text Highlighting:

To enable or disable text highlighting in all open worksheets, place the cursor anywhere in a worksheet, hold down the [SHIFT]+[CMD] (Mac) or [SHIFT]+[CTRL] (Windows) keys and type the letter K.

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.

Find and Replace Text Strings:

To search for and replace a text string in a worksheet:

  1. Hold down the [CMD]+[OPT]+[F] (Mac) or [SHIFT]+[CTRL]+[F] (Windows) keys. A Replace field displays.

    To replace all instances of a text string, hold down the [CMD]+[OPT]+[SHIFT]+[F] (Mac) or [ALT]+[CTRL]+[SHIFT]+[F] (Windows) keys. A Replace All field displays.

  2. Type the string to replace, and press the Enter key. A With field displays.

  3. Type the replacement string, and press the Enter key. A set of options displays.

  4. Click the desired option:


    Replace the current instance of the string with the specified replacement and advance to the next instance.


    Retain the current instance of the string and advance to the next instance.


    Replace all instances of the string with the specified replacement.


    Stop searching for instances of the string.


These keyboard shortcuts are specific to the Classic Console. For shortcuts in Snowsight, see Update worksheets with keyboard shortcuts.

Backing Up Your Own Worksheets

We recommend that users back up complex or crucial worksheets that would be difficult to recreate. Copy and paste the contents of individual worksheets into files that you can safeguard. Backing up your worksheets prevents them from accidental deletion.

Worksheet metadata is stored in the Snowflake user stage, in the worksheet_data directory. Executing the REMOVE command and removing the worksheet_data directory deletes your own worksheets, which cannot be restored.


This precaution applies to worksheets in the Worksheets Worksheet tab tab in the Classic Console only. Worksheets in Snowsight are stored elsewhere and are not prone to accidental deletion.