Skip to main content

SQL Autocomplete

TablePro provides intelligent, context-aware SQL autocomplete that understands your database schema, SQL syntax, and query context. This helps you write queries faster and with fewer errors.
Autocomplete

How Autocomplete Works

The autocomplete system analyzes:
  1. Your current position in the query
  2. SQL syntax context (SELECT, FROM, WHERE, etc.)
  3. Referenced tables and their aliases
  4. Your database schema (tables, columns, functions)
This allows it to suggest only relevant completions based on what makes sense at each point in your query.

Triggering Autocomplete

Automatic

Autocomplete appears automatically as you type:
  • After typing 1-2 characters
  • After typing . (dot) for column access
  • After certain keywords (SELECT, FROM, JOIN, etc.)

Manual

Force the autocomplete popup:
  • Start typing and wait briefly
  • The popup appears with relevant suggestions

Dismissing

  • Press Escape to dismiss the popup
  • Continue typing to filter suggestions
  • Click outside the popup

Completion Types

SQL Keywords

Keywords are suggested based on SQL syntax context:
SEL|  -- Suggests: SELECT
FROM users WH|  -- Suggests: WHERE
SELECT * FROM users WHERE name LIKE '%test%' ORD|  -- Suggests: ORDER
Keyword suggestions
Suggested keywords include:
CategoryKeywords
StatementsSELECT, INSERT, UPDATE, DELETE, CREATE, ALTER, DROP
ClausesFROM, WHERE, JOIN, ON, GROUP BY, ORDER BY, HAVING, LIMIT
OperatorsAND, OR, NOT, IN, LIKE, BETWEEN, IS NULL, EXISTS
JoinsINNER JOIN, LEFT JOIN, RIGHT JOIN, CROSS JOIN

Table Names

Tables are suggested after keywords that expect table references:
SELECT * FROM |  -- Suggests all tables
SELECT * FROM us|  -- Suggests tables starting with "us": users, user_roles
SELECT * FROM users JOIN |  -- Suggests all tables
Table suggestions

Column Names

Columns are suggested based on referenced tables:
SELECT | FROM users  -- Suggests columns from users table
SELECT u.| FROM users u  -- Suggests columns with "u." prefix
SELECT * FROM users WHERE |  -- Suggests columns from users

After Table Alias

When you use a table alias, typing the alias followed by . shows that table’s columns:
SELECT
    u.|  -- Shows: id, name, email, created_at (from users)
FROM users u
JOIN orders o ON u.id = o.|  -- Shows: id, user_id, total (from orders)
Alias suggestions

Functions

SQL functions are suggested in appropriate contexts:
SELECT |  -- Suggests: COUNT, SUM, AVG, MAX, MIN, etc.
SELECT COUNT(|  -- Suggests columns and *
WHERE date_column > |  -- Suggests: NOW(), CURRENT_DATE, etc.
Common function suggestions:
CategoryFunctions
AggregateCOUNT, SUM, AVG, MAX, MIN
StringCONCAT, SUBSTRING, UPPER, LOWER, TRIM
DateNOW, CURRENT_DATE, DATE_FORMAT, DATEADD
MathROUND, ABS, CEIL, FLOOR
ConditionalCOALESCE, NULLIF, CASE, IF

Schema Names

For databases with multiple schemas (PostgreSQL):
SELECT * FROM |  -- Suggests: public, schema1, schema2
SELECT * FROM public.|  -- Suggests tables in public schema

Context-Aware Suggestions

After SELECT

Immediately after SELECT:
  • Column names from tables in FROM clause
  • * for all columns
  • DISTINCT modifier
  • Aggregate functions
SELECT |
-- Suggests: *, DISTINCT, column names, functions

After FROM/JOIN

After FROM or JOIN keywords:
  • All accessible table names
  • Schema-qualified names (schema.table)

After WHERE

In WHERE clauses:
  • Column names from selected tables
  • Comparison operators
  • Logical operators (AND, OR)

After ON (JOIN condition)

In JOIN ON clauses:
  • Columns from both joined tables
  • Commonly used for foreign key relationships
SELECT * FROM users u
JOIN orders o ON |
-- Suggests: u.id, o.user_id, etc.

After GROUP BY

  • Columns that appear in SELECT clause
  • Non-aggregated column names

After ORDER BY

  • Column names
  • Aliases defined in SELECT
  • ASC/DESC keywords

Using Completions

Keyboard Navigation

KeyAction
Down arrowSelect next suggestion
Up arrowSelect previous suggestion
EnterAccept selected suggestion
TabAccept selected suggestion
EscapeDismiss popup

Filtering

Continue typing to filter the suggestions:
SELECT * FROM user|
-- Shows: users, user_roles, user_preferences
-- Typing more narrows results

Accepting Suggestions

When you accept a suggestion:
  1. The suggestion text is inserted at cursor
  2. Any typed prefix is replaced
  3. Cursor moves to end of inserted text

Schema Caching

How Schema is Loaded

When you connect to a database, TablePro:
  1. Fetches all table names
  2. Loads column information for each table
  3. Caches this information for fast autocomplete

Refreshing Schema

If you make schema changes (add tables, alter columns):
  1. Right-click the connection in sidebar
  2. Select Refresh
Or disconnect and reconnect to the database.
Schema changes made in TablePro (via Structure tab) are automatically reflected in autocomplete.

Performance

Large Files

Autocomplete works on SQL files of any size, including multi-megabyte dumps. For files larger than 500 KB, the engine automatically extracts a local window around the cursor and analyzes only the nearby statement, so suggestions remain instant regardless of total file size.

Large Schemas

For databases with many tables (100+):
  • Initial schema loading may take a moment
  • Autocomplete remains responsive after caching
  • Filter suggestions by typing more characters

Tips for Better Performance

  1. Type more characters: Typing more narrows suggestions faster
  2. Use table aliases: Reduces lookup scope
  3. Let caching work: Schema is cached after first load

Limitations

What’s Not Suggested

  • Temporary tables (not in schema)
  • Subquery aliases
  • Dynamic column names
  • Columns from other connections

Query Complexity

Very complex queries may have limited context awareness:
  • Deeply nested subqueries
  • Complex CTEs
  • Dynamic SQL
In these cases, basic keyword and table suggestions still work.

Configuration

Autocomplete is enabled by default with no configuration needed. Future settings may include:
  • Enable/disable autocomplete
  • Autocomplete trigger delay
  • Case sensitivity options

Best Practices

Use Table Aliases

Aliases make autocomplete more precise:
-- Good: Clear which table each column comes from
SELECT u.name, o.total
FROM users u
JOIN orders o ON u.id = o.user_id

-- Less clear without aliases
SELECT users.name, orders.total
FROM users
JOIN orders ON users.id = orders.user_id

Start with FROM

Writing FROM first helps autocomplete know your tables:
-- This approach helps autocomplete
FROM users u
JOIN orders o ON u.id = o.user_id
SELECT u.|  -- Now knows about u and o tables

Let Suggestions Guide You

If you’re not sure of the exact column name:
  1. Type the table alias and dot: u.
  2. Browse the suggestions
  3. Select the correct column

Troubleshooting

Suggestions Not Appearing

  1. Check connection: Ensure you’re connected to a database
  2. Refresh schema: Right-click connection > Refresh
  3. Wait for cache: Large schemas may take time to load

Wrong Suggestions

  1. Check table aliases: Ensure aliases are correctly defined
  2. Check FROM clause: Tables must be referenced to suggest columns
  3. Refresh if schema changed: Schema changes need refresh

Slow Suggestions

  1. Type more characters: Narrows search space
  2. Use aliases: Limits scope of column search
  3. Check database connection: Network latency affects schema loading

Next Steps