SQL Editor overview
Last modified: March 28, 2025
When working with databases, a crucial aspect of user interaction involves writing and executing SQL queries. In SQL Editor, they can create and manage SQL documents and subsequently execute them against the connected database server.
To create a new SQL document:
1. On the standard toolbar, click New SQL.
2. In the Connect to Server window that opens, choose the server you want to connect to or create a new one, and click Connect.
The empty SQL document opens where you can create or update a SQL statement.
SQL document overview
Each SQL document includes different representations of the content: Text and Data document views.
- Text view comprises the SQL Editor, which allows you to write SQL statements.
- Data view, typically shown after a query is executed, comprises the Data Editor that displays the results set returned by a database server.
To switch to a specific view, click the view name at the bottom panel of the document.
Represent query execution results
In the SQL Editor, the query execution results can be represented as a grid (default state) and as cards.
Grid View
To represent results as a grid, click Switch to Grid View on the SQL Editor toolbar.
In the grid view, you can group the execution results by box. To do this, click Show Group by Box and drag a column header to the corresponding area:
The query execution results will look as follows:
Card View
To view the results as cards, click Switch to Card View on the SQL Editor toolbar.
Document layout
SQL document has two types of view layout: Split Layout (default layout) and Combined Layout. To switch between document layouts, use the corresponding options at the bottom-right corner of the document.
Split layout
In the split layout, a document is divided into two horizontal areas:
1. Text - the SQL document you are working with.
2. Data - the query execution result.
A document has the main view, which is aligned to the top of the document viewport, and additional views, which are displayed at the bottom area of the document view.
To change the main document view, click Swap main and additional document views at the bottom of the SQL document.
Combined layout
In the combined layout, you can see only one view at a time.
To switch between the document views, click Text or Data at the bottom of the SQL document.
Text selection
SQL code can be selected in the following ways:
- Use SHIFT + navigational keys, PAGE UP, PAGE DOWN, HOME, and END.
- Use SHIFT + ALT + navigational keys, PAGE UP, PAGE DOWN, HOME, and END.
- Use the mouse.
Bookmarks
dbForge Data Compare allows adding a bookmark to any part of a SQL document. This feature saves a particular line in the code and the cursor position.
To add a bookmark, on the standard toolbar, click Toggle a bookmark on the current line or press Ctrl+K, K.
To navigate the bookmarks:
- Click
Move the caret to the previous bookmark or use the Ctrl+K, Ctrl+P keyboard shortcut.
- Click
Move the caret to the next bookmark or use the Ctrl+K, Ctrl+N keyboard shortcut.
To delete bookmarks in the current document, click Clear all bookmarks in the current document or press Ctrl+K, L.
Code folding
If you are working with a large script, you might need to collapse some of the clauses for convenience. Hovering over the collapsed clause will display its content.
Status bar
The status bar contains the most important information regarding the current connection and query execution.
Environment Category | Connection Status | Host (Server version) | Username | Selected Database |
When you execute a query, the query execution status and the query execution time will be displayed in the status bar.
Environment Category | Query Execution Status | Execution Time | Host (Server version) | Username | Selected Database |
Comment the code
To comment on the part of the SQL code, select it and click Comment out the selected lines on the standard toolbar. Alternatively, press CTRL+K, C. To uncomment a section, select it and click
Uncomment the selected lines on the standard toolbar or use the CTRL+K, U keyboard shortcut.
Want to find out more?
Overview
Take a quick tour to learn all about the key benefits delivered by Data Compare for SQL Server.
All features
Get acquainted with the rich features and capabilities of the tool in less than 5 minutes.
Request a demo
If you consider employing this tool for your business, request a demo to see it in action.