Usually, when you run a query, you receive results in a table format. Each statement appears in a separate tab in the Services tool window. For example, if you have two SELECT statements in the query, you will see two tabs in the tool window.
The Services tool window includes a list of consoles that are grouped according to a connection session to a data source.
Open a new tab for each query
By default, RubyMine updates the same tab with results each time you run a query. You can change this behavior and create a tab each time you run a query.
In the IDE settings Ctrl+Alt+S, go to.
Select the Open results in new tab checkbox and click OK.
View two result sets in the editor
Click the In-Editor Results button to view result sets one above another.
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
/* is treated as a tab title.
Open settings by pressing Ctrl+Alt+S, navigate to.
In the Treat text as title after field, define a combination for tab titles.
To disable this feature, open settings Ctrl+Alt+S, navigate to Create title for results from comment before query checkbox., and clear the
Edit values in the result set
In the result set, click a cell value that you want to edit.
Specify a new value and press Enter.
To submit changes to a database, click the Submit icon (), or press Ctrl+Enter.
Export to a file
To export data to a file, perform one of the following actions:
Right-click a result set, a table, or a view, select Export Data.
Right-click a query and select Export Data to File.
On the toolbar, click the Export Data icon () and select Export to File.
In the Export Data dialog, click Export to File.
Export to a clipboard
Select data in the result set or in the editor and press Ctrl+C.
On the toolbar, click the Export Data icon () and select Copy To Clipboard.
Compare two result sets
Run queries to tables that you want to compare.
In the Services tool window, click the Compare with icon (), and select the result set that you want to add to diff.
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
1in the Tolerance field.
Navigate to a related object
You can retrieve rows from the table for the selected object, and move the focus to the object. For example, select a field in the project tree and press Ctrl+Alt+Home. The focus moves to the corresponding column in the new tab.
To navigate to the object in the result set, select an object and go to Navigate | Related Symbol Ctrl+Alt+Home.
Navigate between related data
You can navigate between different types of related data:
Referenced data: data that is referenced by the current object.
Referencing data: data that is referencing the current object.
Right-click the column in the table and navigate to Go To | Referenced Data Ctrl+B or Ctrl+Alt+Home.
If the Choose Target popup appears, select the table and what rows to show:
First Referencing Row: all rows in the table. The first row that references the current row is selected.
Referencing Rows Only: only rows that reference the current row.
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 and select Pin Active Tab.
Click on the toolbar.
To sort table data in a column, click the corresponding cell in the header row. You can click several header row cells to sort table data on multiple columns.
|Indicates that the data is not sorted in this column. The initial state of the sorting marker.|
|The data is sorted in the ascending order. The number to the right of the marker (1 on the picture) is the sorting level. You can sort by more than one column. In such cases, different columns will have different sorting levels.|
|The data is sorted in the descending order.|
Reset the table view to the initial state
Click the settings icon () and select Reset View. As a result, the data becomes unsorted, the columns appear in the order they were defined initially, and all the columns are shown.
Operations with columns in the structure view
The structure view displays you a list of all the columns in the selected table. The structure view is available in the Structure tool window ( ) or in the popup window (Ctrl+F12).
Sort the data in the ascending Alt+Shift+Up or the descending order (Alt+Shift+Down).
Reset the state of sorting ( Ctrl+Alt+Shift+Backspace )
Hide a column or show a hidden column (Space). The names of hidden columns are shown struck-through.
Export data to a database
Make sure that the database is added as a data source in the Database tool window.
Right-click any cell in the table and then click Export to Database.
Specify the database, target schema (to create a new table with the exported data) or table (to add exported data to an existing table).
Configure the data mapping and settings for the target table.
Edit data in INSERT statements as a table
INSERTstatements that you want to edit.
Right-click the selection and click Edit as Table.
Logging SQL activity
Locate system query log
SQL log includes all queries that you have ever run in RubyMine. It means all user queries and all internal queries (except for the queries that are run by the JDBC driver). The log information is stored in database.log. The database.log file is stored on your hard drive until you delete or overwrite the file. When the file size reaches 1 MB, a new file with a different name is created.
To locate database.log, click . You can open database.log in RubyMine or in a text editor.
Change location of the SQL log
To change location of the SQL log, add the
-Didea.system.path property to the custom VM options. This change affects all logs.
At the end of the option list, add the following line: