DBXDBX

Query Editor

Write, complete, format, execute, and reuse SQL in DBX.

The query editor is where daily SQL work happens: writing queries, using completion, formatting statements, executing selected fragments, and returning to previous SQL through history.

Basic Workflow

Open a Connection

Select a database connection from the sidebar. DBX loads the database type and metadata for the active connection.

Write SQL

Type SQL in the editor. Completion suggestions use SQL keywords, tables, views, columns, and available relationship metadata.

Execute the Query

Use the shortcut to execute all SQL or only the selected fragment. Results appear in the data grid below the editor.

Reuse History

Open query history to bring back previously executed SQL for repeated debugging or analysis.

Execute SQL

ActionmacOSWindows / Linux
Execute all SQLCmd+EnterCtrl+Enter
Execute selected SQLSelect text, then Cmd+EnterSelect text, then Ctrl+Enter

When text is selected, DBX executes only the selected SQL. When nothing is selected, it executes the full editor content.

After execution, the result area shows returned rows, duration, affected row count, or the error message. For multi-statement scripts, select the exact fragment you want to run to reduce mistakes.

DBX also tracks query sessions so long-running result sets can be closed when you leave them, and active queries can be cancelled from the UI when the database driver supports cancellation.

Execution Scope

ScopeHow It Is ChosenUse Case
Selected SQLHighlight text before runningSafest option for multi-statement scratch pads
Current statementUse editor cursor workflows where availableRun one statement without selecting text manually
Full editorRun with no selectionSingle-purpose query tabs and short scripts

DBX can execute batches and scripts, but the query editor is still safest when you run one reviewed statement at a time. Use SQL File Execution for large .sql files that need progress tracking.

Autocomplete

Completion suggestions come from the active database context:

  • SQL keywords: SELECT, FROM, WHERE, GROUP BY, and more
  • Object names: tables, views, schemas, and databases
  • Column names: inferred from referenced tables and aliases
  • JOIN suggestions: related tables and join conditions from foreign keys or known relationships
  • SQL Server syntax: CROSS APPLY, OUTER APPLY, and related completions for SQL Server connections

Completion accuracy depends on connection metadata. If you just created a table or changed columns, refresh the connection metadata and try again.

Format SQL

Use the format button in the toolbar to standardize indentation, line breaks, and keyword style. Formatting is useful before sharing a query, reviewing a migration script, or debugging a complex statement.

Formatting only changes the editor text. It does not execute SQL or modify the database.

Query History

DBX records executed SQL so you can reuse it later:

  • History is stored per connection
  • Previous statements can be reviewed by time
  • Clicking a history item loads it back into the editor
  • Useful for investigation queries, reports, and repair statements
  • History entries preserve enough context to identify manual queries and AI-assisted work

Query history may include business fields, table names, or filter values. Be mindful of sensitive information on shared machines or demo environments.

Working With the Data Grid

Query results open in the Data Grid. If the result is editable, DBX shows the SQL before saving changes. For analysis-only results, you can export CSV, JSON, or Markdown.

Working With AI

The editor can send the current SQL, active connection type, database name, recent error, result preview, and loaded schema context to the AI Assistant. In Ask mode, AI returns SQL and explanations only. In Agent mode, DBX applies an execution policy before attempting to run generated SQL.

On this page