Writing SQL Queries with Code Completion

dbForge Studio can save your time whether you write an SQL query or format your code. This topic briefly explains how to write SQL queries using dbForge Studio.

Writing a Query

For example, you need to write a SQL query like SELECT * FROM SCOTT.EMP.

  1. Open a new SQL document and select a connection with the SCOTT database from the Connection list box on the SQL toolbar.
  2. Start typing: se (press Enter) * fr (press Enter) When you are typing, the suggestion box appears with the list of suggestions that are relevant to the typed symbols. The suggestions are filtered to display most relevant ones at the top of the list. To insert a suggestion into your code, navigate to a required one by using Up and Down arrow keys, and then press Enter.


    The first suggestion in the list is considered the most relevant, that is why it is highlighted to speed up the insertion.

  3. Press the Space key and type em (press Enter).

Formatting SQL Code

dbForge Studio can quickly format your SQL code depending on selected formatting options. To format your code, click Enable Code Completion for current document on the SQL toolbar.

You can format SQL code even if Code Completion is disabled. Select a statement, and then click Format Current Statement on the shortcut menu if you want to format the whole code, or click Format Selection if you want to format a highlighted code fragment.

To disable code formatting for a specific part of the code, use the – noformat – endnoformat tags.

Inserting a Snippet

To insert a snippet to your SQL code, type first letter for a required statement in SQL editor. The statements prompt list appears. Select a statement itself, or insert a whole snippet. Snippets follow after the statements in the prompt list. Navigate to a required snippet, and press ENTER. Alternatively, click Insert Snippet on the shortcut menu.

dbForge Studio for Oracle allows navigating through the data input fields, where you can specify your own data. Use the TAB key to go forward and the TAB+SHIFT keys to go back.