# Query results

> For the complete documentation index, see [llms.txt](https://www.jetbrains.com/help/idea/2026.3/llms.txt).

In IntelliJ IDEA, you can [run queries in
query consoles](run-a-query.html#run_statements_in_a_query_console) and then view and work with the result set data using the IDE interface.

## Display

Usually, when you run a query, you receive results in a table format. IntelliJ IDEA displays the results in a data editor.

The data editor and viewer, or data editor, provides a user interface for working with data. In the data editor, you can sort, filter, add, edit, and remove the data as well as perform other associated tasks.

By default, IntelliJ IDEA displays the data editor with query results [in a separate
tab of the
Services

tool window](#result_tabs). You can also set the results to appear in your query console by using the [in-editor results
feature](#in_editor_results).

Query result set: Services  tool window:

![Data editor in a Result tab](https://resources.jetbrains.com/help/img/idea/2026.3/db_data_editor_query_result_tab_glossary.png)

Query result set: In-Editor Results:

![Data editor in the in-editor results](https://resources.jetbrains.com/help/img/idea/2026.3/db_data_editor_query_result_ineditor_glossary.png)

Procedure: Select where to display query output and results

You can configure the IDE to display output and results in the Database Output tool window, inline in the editor, or in the Services tool window.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) to open settings and then select `Tools | Database | Query Execution | Output and Results`.

2. In Show results in, select the location.

3. Click OK to apply the changes.

For more information about query consoles and tool windows, refer to  [Query consoles](query-consoles.html), [Database Output tool window](database-output-tool-window.html), and [Services tool window](services-tool-window.html).

Procedure: View, format, and work with output

* For more information about how to view the results, change the output format, and work with data in it, refer to  the [Data editor and viewer](data-editor-and-viewer.html) section:

* [View data](tables-view-data.html)

* [Compare data](compare-data.html)

* [Sort data](tables-sort.html)

* [Filter data](tables-filter.html)

* [Rows](rows.html)

* [Cells](cells.html)

### Result tabs in Services tool window

By default, data editor with results appears in the Result tab of the  Services  .

Procedure: Run a query and view results in Services tool window

1. In a query console, type or paste the query that you want to run.

2. Click ![the Execute button](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.run.run.svg) Execute on the toolbar. Alternatively, press `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` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)).

IntelliJ IDEA displays the query result set in the  Services   tool window tab.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/db_query_results_in_services_tool_window.mp4)

Procedure: Open a new tab for each new query

By default, IntelliJ IDEA updates the same tab with results each time you run a new query after the previous one. You can change this behavior and create a tab each time you run a new query.

1. In the IDE settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)), go to `Tools | Database | Query Execution`.

2. Select the Open results in new tab checkbox and click OK.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/db_open_new_tab_for_each_new_query.mp4)

Procedure: Use custom titles for tabs with results

You can define a tab title in the comment section before the query. In the Treat text as title after field, you can reserve a combination of symbols or characters after which any text will be treated as a tab title. By default, no combination is used, so any text after `--` or `/*` is treated as a tab title.

1. Open settings by pressing `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)), navigate to `Tools | Database | Query Execution | Output and Results`.

2. In the Treat text as title after field, define a combination for tab titles.

To disable this feature, open settings `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)), navigate to `Tools | Database | Query Execution | Output and Results`, and clear the Create title for results from comment before query checkbox.

For more examples of custom titles for tabs, refer to [Name the result tabs at youtube.com](https://www.youtube.com/watch?v=U5SOD-eeK50&t=795s).

![Use custom titles for tabs with results](https://resources.jetbrains.com/help/img/idea/2026.3/db_use_custom_titles_for_result_tabs.png)

Procedure: Pin the tab with query results

If one and the same tab is used to show your query results, and you get the result that you want to keep, you can pin the tab to the tool window.

* Right-click the tab header and select Pin Tab.

![Pin the Result tab](https://resources.jetbrains.com/help/img/idea/2026.3/db_pin_the_result_tab.png)

### In-Editor Results in query consoles

You can also view the query results within the editor. To do that, use the In-Editor Results feature.

Procedure:

* To toggle the In-Editor Results feature for the current file, click ![the In-Editor Results icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.editorOutput.svg) In-Editor Results on the toolbar.

* To toggle the In-Editor Results feature for all files across the IDE, open settings by pressing `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS)) and navigate to `Tools | Database | Query Execution | Output and Results | Output and Results`. In Show results in, select Editor.

Enabled:

![Enable in-editor results for the current file](https://resources.jetbrains.com/help/img/idea/2026.3/db_toggle_in_editor_results_on.png)

Disabled:

![Disable in-editor results for the current file](https://resources.jetbrains.com/help/img/idea/2026.3/db_toggle_in_editor_results_off.png)

Procedure: Open result sets in editor tabs

You can open a result set in a separate editor tab to work with it in the main editor area.

1. Select the result set in the Database Output tool window.

2. On the result toolbar, click ![the Open in Editor tab icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.general.openNewTab.svg) Open in Editor Tab.

The result set opens in an editor tab, like a database table.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/db_open_query_result_set_in_main_editor_tab.mp4)

For a query result set, you can view the original query in a separate popup.

Procedure: View the query that produced a result set

1. Select the result set in the Database Output tool window.

2. On the data editor toolbar, click SQL.

The Query popup displays the query that produced the selected result set.

![Dialog with the original query](https://resources.jetbrains.com/help/img/idea/2026.3/db_database_output_tw_sql_button_popup.png)

The original query popup dialog provides the following actions:

![the Copy to Clipboard icon](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.copy.svg) Copy to Clipboard
: Copy the query text to the clipboard.

![the Execute Query icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.consoleRun.svg) Execute query
: Execute the query.

![the Highlight in Editor icon](https://resources.jetbrains.com/help/img/idea/2026.3/app-client.expui.general.locate.svg) Highlight in editor
: Navigate to the query in its source file and place the caret on its first line.

## Editing and exploration

Procedure: View two result sets in the editor

* Click ![the In-Editor Results icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.editorOutput.svg) In-Editor Results on the toolbar to view the result sets one above the other.

![View two result sets in the editor](https://resources.jetbrains.com/help/img/idea/2026.3/db_view_two_result_sets_in_the_editor.png)

Procedure: Edit values in the result set

1. In the result set, click a cell value that you want to edit.

2. Specify a new value 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)).

3. To submit changes to a database, click ![the Submit icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.submitDB.svg) Submit on the toolbar, or press `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` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)).

For a full tutorial on submitting changes to a database, refer to  the [Submit changes to a database](submitting-and-reverting-changes.html) topic.

![Modify values in the result set](https://resources.jetbrains.com/help/img/idea/2026.3/db_change_data_in_result_set.png)

Procedure: Edit multi-table JOIN results

1. In the grid, double-click the cell or select it 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS))

2. Make your changes.

3. 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` (Visual Studio), `⏎` (Visual Studio (macOS)), `Enter` (NetBeans), `Enter` (Eclipse), `⏎` (Eclipse (macOS)) or click any other area.

4. To submit changes to a database, click ![the Submit icon](https://resources.jetbrains.com/help/img/idea/2026.3/database-plugin.icons.expui.submitDB.svg) Submit on the toolbar, or press `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` (Visual Studio), `⌘ ⏎` (Visual Studio (macOS)), `Ctrl+Enter` (NetBeans), `Ctrl+Enter` (Eclipse), `⌘ ⏎` (Eclipse (macOS)).

5. Review the generated scripts in the DML Preview dialog that appears.

6. Click Submit to submit your changes to the database.

To ensure this feature works properly, each row must have a field or set of fields that uniquely identifies it.

This feature is not supported for the SQL `UNION` operator, table self-join operation results, result sets with calculation result columns (for example, `CONCAT`), or NoSQL databases.

![DML Preview dialog with the generated statements](https://resources.jetbrains.com/help/img/idea/2026.3/db_editable_results_select_with_join_rn.png)

Procedure: Compare two result sets

1. Run queries to tables that you want to compare.

2. In the  Services   tool window, click ![The Compare with icon](https://resources.jetbrains.com/help/img/idea/2026.3/app.expui.vcs.diff.svg) Compare Data, and select the result set that you want to add to diff.

3. If needed, change a value of the Tolerance parameter in the comparison dialog. The Tolerance parameter defines a maximum number of differences that are allowed between two result sets. For example, if you want to consider two rows as equal if their data differs in a single column, enter `1` in the Tolerance field.

See another example of comparing two result sets in [Compare data at youtube.com](https://www.youtube.com/watch?v=U5SOD-eeK50&t=834s).

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/db_result_sets_diff.mp4)

## Output tab

Procedure: View query log

On the Output tab of the  Services   tool window, you can see a log of user and internal queries.

1. In the   Database   tool window ,  open a query console by right-clicking a data source and navigating to `New | Query Console`.

Alternatively, select a data source and press `F4` (Windows), `⌘ ↓` (macOS), `F4` (IntelliJ IDEA Classic (macOS)), `F4` (macOS System Shortcuts), `F4` (XWin), `F4` (GNOME), `F4` (KDE), `F4` (Emacs), `F4` (Sublime Text), `F4` (Sublime Text (macOS)), `F4` (Visual Studio), `⌘ ↓` (Visual Studio (macOS)), `F4` (NetBeans), `F12` (Eclipse), `F3` (Eclipse (macOS)).

2. Run a query.

3. In the  Services   tool window that opens, click the Output tab.

[Video](https://resources.jetbrains.com/help/img/idea/2026.3/db_query_output.mp4)

## Services tool window reference

For more information about tool window controls and tabs, refer to  the [the Services tool window](services-tool-window.html#db-sessions) topic.

![Database services in the Services tool window](https://resources.jetbrains.com/help/img/idea/2026.3/db_services_tool_window_database_services.png)

## See also

### Procedures

[Data editor and viewer](data-editor-and-viewer.html) [Tables](working-with-the-data-editor.html) [Injected SQL statements](running-injected-sql-statements.html)

### Reference

[Query console](query-consoles.html#reference) [Data editor and viewer](data-editor-and-viewer.html#reference)

