When working with databases, a crucial aspect of your interaction involves writing and executing SQL queries. In the dbForge product line, the SQL document plays a pivotal role that gives you an opportunity to create SQL statements and subsequently execute them against the connected database server.
The guide explores the following topics:
To create a new SQL Document:
1. On the standard toolbar, click New SQL.
2. In the Connect to Server that opens, choose the server you want to connect to and click Connect.
The empty SQL document opens where you can insert and update a SQL statement.
Each SQL document includes different representations of the content: Text and Data document views.
To switch to a specific view:
In SQL Editor, the query execution results can be represented in two ways: Grid (default state) and Card Views.
To represent results as a grid, click Switch to Grid View on the SQL Editor toolbar. The following image represents a sample of query execution results in a grid format.
To view the results as cards, click Switch to Card View on the SQL Editor toolbar. The following image represents a sample of query execution results in text format.
SQL document has two types of view layout: Split Layout (default layout) and Combined Layout. To switch document layout, use the appropriate options at the bottom-right corner of the document.
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 viewport.
To swap the main view and active additional view, click Swap main and additional document views at the bottom of the SQL document.
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.
There are three ways to select a block of SQL code:
dbForge Event Profiler allows adding a bookmark to any part of your 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:
To delete bookmarks in the current document, click Clear all bookmarks in the current document or press Ctrl+K, L.
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.
The status bar contains the most important information regarding the current connection and query execution.
where:
When you execute a query, the query execution status and the query execution time will be displayed in the status bar.
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.