Autocomplete

Alias-Resolving Logic

Autocomplete Settings


Autocomplete

SQLTools provides an autocomplete feature to assist with writing SQL and PL/SQL code.

Press Ctrl+Shift+Space to display a list of objects belonging to the current user. You can limit which types of objects appear — for example, only tables and views — in the Autocomplete Settings.

If the cursor is placed after a schema name followed by a dot, the autocomplete list will show the objects of that schema.

If the cursor is placed after a table name or table alias followed by a dot, the autocomplete list will show the columns of that table. SQLTools includes sophisticated alias‑resolution logic (see the linked documentation).

PL/SQL packages are handled similarly: place the cursor after a package name and a dot, and the autocomplete list will show all package procedures along with their parameters.

Normally, the autocomplete list allows you to select a single item and insert it at the cursor position by pressing Enter.

However, SQLTools also supports an advanced mode for working with table and view columns. You can select multiple columns in the desired order using Space, Ins, or Ctrl + Left Click. All selected columns will then be inserted at the cursor position. The inserted text will be formatted either as a single line or multiple lines, depending on the Autocomplete Settings.

See the example:

The SQL before (the ^ shows the cursor position):

SELECT
  b.^
FROM bonus b
  WHERE ...

The SQL after:

SELECT
  b.ename
  , b.sal
  , b.job
  , ^
FROM bonus b
  WHERE ...

Alias-Resolving Logic

When you write SQL queries in SQLTools, the editor helps you by understanding and resolving table and subquery aliases in your SQL statements. This makes writing, navigating, and understanding complex SQL much easier.

Table and Alias Resolution

Subquery Handling

Alias Scope and Isolation

What You Need to Do

Example 1
SELECT e.name, d.department_name
FROM employees e
JOIN departments d ON e.department_id = d.id
WHERE e.salary > 1000

In this example, e and d are aliases for employees and departments, and SQLTools resolves them automatically.

Example 2
SELECT d.name
FROM (SELECT * FROM departments) d
WHERE d.department_id > 10

Here, d is an alias for the subquery, and SQLTools resolves that it refers to the departments table.

Example 3
SELECT d.name
FROM (
    SELECT department_id, name
    FROM departments
) d
WHERE d.department_id > 10

In this example, d is an alias for the subquery. SQLTools can extract the column list directly from the subquery and understands that there is no need to retrieve the full column list from the departments table.


Autocomplete Settings

Available from the top menu: Tools → Settings...