# Code editor tips and reference

Procedure: Change the SQL dialect in the code editor

> **Note:**
> SQL dialect is defined by the attached data source or schema. The dialect can only be changed for Oracle DBMS.

* Right-click the editing area and select Change Dialect (<current_dialect>) to. In the Change SQL Dialect window, select a dialect.

## Productivity tips

Procedure: View history of a query console

* In a query console, right-click any area and select `Local History | Show History`.

For more information about local history of a file, refer to the [Local History](local-history.html) topic.

Procedure: Apply a code style in the editor

1. Right-click any area or a selection of code in the editor and select Reformat Code. Alternatively, press `Ctrl+Alt+L` (Windows), `⌘ ⌥ L` (macOS), `⌘ ⌥ L` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ L` (macOS System Shortcuts), `Ctrl+Alt+L` (XWin), `Ctrl+Alt+L` (GNOME), `Alt+Shift+L` (KDE), `Ctrl+Alt+L` (Emacs), `Ctrl+Alt+L` (Sublime Text), `⌘ ⌥ L` (Sublime Text (macOS)), `Alt+Shift+F` (NetBeans), `Ctrl+Alt+Enter` (Visual Studio), `⌘ ⌥ ⏎` (Visual Studio (macOS)), `Ctrl+Alt+L` (Eclipse), `⌘ ⇧ F` (Eclipse (macOS)).

2. Select the scope.

3. Click Run.

![Apply a code style in the editor](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_apply_a_code_style_in_the_editor.png)

Procedure: View the file path of a query console

* To see the details of a file, hover over the query console tab.

Procedure: Navigate to a query console from the Select In window

* Press `Alt+F1` (Windows), `⌥ F1` (macOS), `⌥ F1` (IntelliJ IDEA Classic (macOS)), `⌃ Q` (macOS System Shortcuts), `Alt+F1` (XWin), `Alt+Shift+1` (GNOME), `Alt+Shift+1` (KDE), `Alt+F1` (Emacs), `Alt+F1` (Sublime Text), `⌥ F1` (Sublime Text (macOS)), `Ctrl+Shift+1` (NetBeans), `Alt+F1` (Visual Studio), `⌥ F1` (Visual Studio (macOS)), `Alt+F1` (Eclipse), `⌘ ⌥ W` (Eclipse (macOS)), select Project View and press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

![Navigate to a query console  from the Select In window](https://resources.jetbrains.com.cn/help/img/idea/2026.2/navigate_to_console_from_select_in.png)

Procedure: Edit data in INSERT statements as a table

1. Select `INSERT` statements that you want to edit.

2. Right-click the selection and click Edit as Table.

![Edit data in INSERT statements as a table](https://resources.jetbrains.com.cn/help/img/idea/2026.2/db_edit_insert_statement_as_table.png)

3. In the table editor that opens, make necessary changes in the table cell. Press `Enter` (Windows), `⏎` (macOS), `⏎` (IntelliJ IDEA Classic (macOS)), `⏎` (macOS System Shortcuts), `Enter` (XWin), `Enter` (GNOME), `Enter` (KDE), `Enter` (Emacs), `Enter` (Sublime Text), `⏎` (Sublime Text (macOS)), `Enter` (NetBeans), `Enter` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) to confirm.

## Reference

### Context menu

In the code editor context menu, use the following actions to increase your productivity:

Duplicate
: (Query consoles only) Creates a copy of the query console.

![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.table.svg) Edit as Table
: In `INSERT` statements, opens the editor for working with the data in a table format.

Change Dialect (<CurrentDialect>)
: (Oracle only) Change the SQL dialect. Select a dialect from the list.

Explain Plan | Explain Plan
: Shows an [execution plan](https://en.wikipedia.org/wiki/Query_plan) (or explain plan) for the current statement. The result is shown in a mixed tree/table format on a dedicated Plan tab.
:
:
:
: To [build a diagram of
: the execution plan](query-execution-plan.html#visualize_query_plan), click ![the Show Diagram icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.fileTypes.diagram.svg) Show Diagram on the left of the Plan tab, or press `Ctrl+Alt+Shift+U` (Windows), `⌘ ⌥ ⇧ U` (macOS), `⌘ ⌥ ⇧ U` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ⇧ U` (macOS System Shortcuts), `Ctrl+Alt+Shift+U` (XWin), `Ctrl+Alt+Shift+U` (GNOME), `Ctrl+Alt+Shift+U` (KDE), `Ctrl+Alt+Shift+U` (Emacs), `Ctrl+Alt+Shift+U` (Sublime Text), `⌘ ⌥ ⇧ U` (Sublime Text (macOS)), `Ctrl+Alt+Shift+U` (NetBeans), `Ctrl+Alt+Shift+U` (Visual Studio), `⌘ ⌥ ⇧ U` (Visual Studio (macOS)), `Ctrl+Alt+Shift+U` (Eclipse), `⌘ ⌥ ⇧ U` (Eclipse (macOS)).
:
:
:
: To build a flame graph, click ![the Flame Graph icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.SQLGroupByType.svg) Flame Graph.

Explain Plan | Explain Analyse
: Executes the statement and then shows an [execution plan](https://en.wikipedia.org/wiki/Query_plan) (or explain plan) for it.

![the Execute icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) Execute `Ctrl+Enter` (Windows), `⌘ ⏎` (macOS), `⌘ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⏎` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+Enter` (Emacs), `Ctrl+Enter` (Sublime Text), `⌘ ⏎` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS))
: Execute the current statement or the sequence of selected statements.

![the Execute icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) Execute Selection as Single Statement
: For a code selection, execute the chunk of code as a single SQL statement.

![the Execute to File icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg) Execute to File
: Execute the current statement and save results in a text file. Select the output format and specify the file location and name.

Run 'query file' `Ctrl+Shift+F10` (Windows), `⌃ ⇧ R` (macOS), `⌃ ⇧ F10` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ R` (macOS System Shortcuts), `Ctrl+Shift+F10` (XWin), `Ctrl+Shift+F10` (GNOME), `Ctrl+Shift+F10` (KDE), `Ctrl+Shift+F10` (Emacs), `Ctrl+Shift+F10` (Sublime Text), `Ctrl+Shift+F10` (Sublime Text (macOS)), `Alt+Shift+F6` (NetBeans), `Ctrl+Alt+F5` (Visual Studio), `⌃ ⌥ F5` (Visual Studio (macOS)), `Ctrl+Shift+F10` (Eclipse), `⌃ ⇧ R` (Eclipse (macOS))
: (Query files only) Execute all the statements in the query file.

Attach Data Source
: (Query files only) Attach one of the existing data sources to the query file.

Switch Data Source
: (Query files only) For a query file with an attach data source, attach another data source.

`Diagrams | Show Diagram…` `Ctrl+Alt+Shift+U` (Windows), `⌘ ⌥ ⇧ U` (macOS), `⌘ ⌥ ⇧ U` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ ⇧ U` (macOS System Shortcuts), `Ctrl+Alt+Shift+U` (XWin), `Ctrl+Alt+Shift+U` (GNOME), `Ctrl+Alt+Shift+U` (KDE), `Ctrl+Alt+Shift+U` (Emacs), `Ctrl+Alt+Shift+U` (Sublime Text), `⌘ ⌥ ⇧ U` (Sublime Text (macOS)), `Ctrl+Alt+Shift+U` (NetBeans), `Ctrl+Alt+Shift+U` (Visual Studio), `⌘ ⌥ ⇧ U` (Visual Studio (macOS)), `Ctrl+Alt+Shift+U` (Eclipse), `⌘ ⌥ ⇧ U` (Eclipse (macOS))
: Opens a diagram in a separate editor tab.

`Diagrams | Show Diagram Popup…` `Ctrl+Alt+U` (Windows), `⌘ ⌥ U` (macOS), `⌘ ⌥ U` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ U` (macOS System Shortcuts), `Ctrl+Alt+U` (XWin), `Ctrl+Alt+U` (GNOME), `Ctrl+Alt+U` (KDE), `Ctrl+Alt+U` (Emacs), `Ctrl+Alt+U` (Sublime Text), `⌘ ⌥ U` (Sublime Text (macOS)), `Ctrl+Alt+U` (NetBeans), `Ctrl+Alt+U` (Visual Studio), `⌘ ⌥ U` (Visual Studio (macOS)), `Ctrl+Alt+U` (Eclipse), `⌘ ⌥ U` (Eclipse (macOS))
: Opens a diagram in a popup.

### Toolbar controls

| Icon | Action and shortcut | Description |
| --- | --- | --- |
|  ![the Execute button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.run.svg)  |    Execute   `Ctrl+Enter` (Windows), `⌘ ⏎` (macOS), `⌘ ⏎` (IntelliJ IDEA Classic (macOS)), `⌘ ⏎` (macOS System Shortcuts), `Ctrl+Enter` (XWin), `Ctrl+Enter` (GNOME), `Ctrl+Enter` (KDE), `Ctrl+Enter` (Emacs), `Ctrl+Enter` (Sublime Text), `⌘ ⏎` (Sublime Text (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS))  |      Execute selected SQL statement or statements.     If nothing is selected, the current statement is executed.     |
|  ![the Explain plan icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.consoleShowPlan.svg)  |    Explain Plan    |    Open the Explain Plan actions menu.       For more information about functionality, refer to  the [Query execution plan](query-execution-plan.html) topic.     |
|  ![the Browse Query History button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.history.svg)  |     Browse Query History   `Ctrl+Alt+E` (Windows), `⌘ ⌥ E` (macOS), `⌘ ⌥ E` (IntelliJ IDEA Classic (macOS)), `⌘ ⌥ E` (macOS System Shortcuts), `Ctrl+Alt+E` (XWin), `Ctrl+Alt+E` (GNOME), `Ctrl+Alt+E` (KDE), `Ctrl+Alt+E` (Emacs), `Ctrl+Alt+E` (Sublime Text), `⌘ ⌥ E` (Sublime Text (macOS)), `Ctrl+Alt+E` (NetBeans), `Ctrl+Alt+E` (Visual Studio), `⌘ ⌥ E` (Visual Studio (macOS)), `Ctrl+Alt+E` (Eclipse), `⌘ ⌥ E` (Eclipse (macOS))  |     Open a dialog that shows all the statements that you have run for the corresponding data source.       See also, [Use the Query History dialog](run-a-query.html#use_the_query_history_dialog).       |
|  ![the View Parameters button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.viewParameters.svg)  |    View Parameters    |     Open or close the Parameters dialog.        For more information about user parameters, refer to  the [Run queries](run-a-query.html#user_parameters) topic.     |
|  ![the Open Query Execution Settings button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.general.settings.svg)  |    Open Query Execution Settings…    |     Open the  `Tools \| Database \| Query Execution` section of the Settings dialog to view or edit the query execution settings.      For more information about these settings, refer to [Query Execution](query-execution.html).    |
| ![](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.editorOutput.svg) | In-Editor Results |    Toggle the display of query result within the code editor of query console.        For more information about the in-editor results, refer to  [In-Editor Results](viewing-query-results.html#in_editor_results).     |
| ![Transaction mode](https://resources.jetbrains.com.cn/help/img/idea/2026.2/buttonTransactionControlDB.png)     | Transaction Mode     and     Transaction Isolation    |    Select the [isolation level](https://en.wikipedia.org/wiki/Isolation_(database_systems)) for database transactions and the way the transactions are committed.       * Auto: the current transaction is committed automatically when you submit your local changes to the database server.    * Manual: the changes submitted to the database server are accumulated in a transaction that can either be committed or rolled back explicitly by means of ![the Submit and Commit icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.commit.svg) Submit and Commit or ![the Roll Back button](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.rollback.svg) Roll Back buttons on the toolbar.      For more information about database transaction modes and isolation, refer to [Submit changes to a database](submitting-and-reverting-changes.html).     |
|     ![the Commit icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.commit.svg)    |     Commit    |     (For the Manual transaction mode.)  Commit the current transaction. This button is available only for the manual transaction mode. See also, [transaction mode and                     isolation](submitting-and-reverting-changes.html).     |
|    ![the Roll back icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.rollback.svg)  |       Roll back     |  (For the Manual transaction mode.) Roll back changes. This button is available only for the manual transaction mode. See also, [transaction modes and isolation](submitting-and-reverting-changes.html).  |
|     ![the Cancel Running Statements icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/app-client.expui.run.stop.svg)          |  Cancel Running Statements    `Ctrl+F2` (Windows), `⌘ F2` (macOS), `⌘ F2` (IntelliJ IDEA Classic (macOS)), `⌃ ⇧ .` (macOS System Shortcuts), `Ctrl+F2` (XWin), `Ctrl+F2` (GNOME), `Ctrl+2` (KDE), `Ctrl+F2` (Emacs), `Ctrl+F2` (Sublime Text), `Ctrl+F2` (Sublime Text (macOS)), `Shift+F5` (NetBeans), `Shift+F5` (Visual Studio), `⇧ F5` (Visual Studio (macOS)), `Ctrl+F2` (Eclipse), `⌘ F2` (Eclipse (macOS))  |  Terminate execution of the current statement or statements.   |
| ![Playground](https://resources.jetbrains.com.cn/help/img/idea/2026.2/button_resolve_mode_db.png) |    File Resolve Mode    |          Select the resolve mode to manage the context that database objects in your code are resolved to.        * Playground: default mode for query consoles. All the database objects are resolved to the same context.    * Script: default mode for local SQL files. The `USE` SQL statement (`SET search_path TO` for PostgreSQL) overrides the default context that the database objects are resolved to.      For more information about the resolve modes, refer to [Resolve modes](run-a-query.html#resolve_modes).          |
| ![the Enable DBMS_OUTPUT icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.dbmsOutput.svg) | Enable DBMS_OUTPUT |     (Oracle and IBM Db2 LUW only) Toggles `DBMS_OUTPUT` for the query console.     |
|  ![the Generate Code with AI icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/fullLine.icons.previous.aiAssistantColored.svg)  |  Generate Code with AI   |    Opens the input field for your prompt to AI Assistant.        For more information about AI Assistant in-editor code generation, refer to  the [AI Assistant documentation](https://www.jetbrains.com.cn/en-us/help/ai-assistant/code-generation.html),     |
| ![the Role and warehouse icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin-frontend.icons.expui.roleWarehouseSwitcher.svg) <default>    |    Select role and warehouse   |     (Snowflake only) Select the role and warehouse for the query console.     |
| ![the Switch current schema icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.schema.svg) <schema>    |    Switch current schema   |    Select the default schema or database. For PostgreSQL, Amazon Redshift, and Greenplum use the <schema> list to form the schema search path.       For more information about about default schemas, refer to  [Set the default schema](schemas.html#set_the_default_schema).     |
| ![the Switch attached data source icon](https://resources.jetbrains.com.cn/help/img/idea/2026.2/database-plugin.icons.expui.dbms.svg) <data source>    |    Switch attached data source   |     (Query files only) Select the data source to use for the query file.     |

