DBX

SQL Quick Actions

SQL Quick Actions let you run reusable SQL against the text you have selected in the query editor. Select a table identifier first, then press the shortcut you configured in Settings → Shortcuts.

This is different from SQL Snippets, which insert templates at the cursor through completion. Quick Actions generate SQL from the current selection and send it through the normal execution path.

Manage Quick Actions

Open Settings → Shortcuts and scroll to SQL Quick Actions.

Built-in templates

DBX ships two built-in actions (shown as Built-in in the list):

ActionDefault shortcutEditable
Select first N rowsMod+Shift+1Shortcut and row count
Count rowsMod+Shift+2Shortcut only

Built-in labels are localized and not user-editable. They always apply to all databases and cannot be deleted (disable them instead). An empty list restores these defaults; existing lists append any missing built-in ids without overwriting your edits.

Custom actions

Click Add to create a custom template. Each custom action includes:

FieldPurpose
LabelName shown in the settings list.
ShortcutKey combination that runs the action.
DatabasesOptional scope. Empty means all databases; otherwise the action only runs for selected types.
SQL TemplateCustom SQL with ${table}. When scoped to specific databases, you can edit a different SQL body per type.
StatusEnables or disables the action without deleting it.

You cannot create another “first N rows” action type from Add—that remains a built-in responsibility. Changes are saved immediately from the action dialog, or when you click Apply in the settings window.

Quick Actions run only in the SQL editor (MySQL, PostgreSQL, Hive, ClickHouse, and other SQL dialects). They do not fire in Redis, MongoDB, Elasticsearch, or other non-SQL editors.

Shortcuts that include Mod (Cmd on macOS, Ctrl on Windows/Linux) are recommended. They are less likely to interfere with normal typing than bare letter keys such as Shift+U.

Select first N rows

The built-in Select first N rows action adapts syntax for the active connection:

  • MySQL / PostgreSQL / unknown JDBC: LIMIT N
  • SQL Server: TOP N
  • Oracle / Dameng: ROWNUM
  • DB2: FETCH FIRST N ROWS ONLY

You only configure the row count and shortcut once. Unknown JDBC connections use LIMIT so the action never runs an unbounded SELECT *.

Custom SQL per database

When a custom action is limited to specific database types, the SQL editor shows a dialect dropdown next to the template:

  • Switching databases auto-saves the current textarea into that type’s override (sqlByDatabaseType), then loads the next type (override if present, otherwise the default sql).
  • Dialog Save persists the default sql plus overrides only for databases you actually edited—it does not copy the current text onto every selected type.
  • Apply to all selected copies the current textarea to every selected type and updates the default sql.
  • Unchecking a database deletes its override (re-checking does not restore it). Switching back to All databases clears all overrides and keeps the currently visible text as the single template.

Run a Quick Action

  1. Select a table name or qualified identifier in the SQL editor, for example orders or public.users. You can also place the caret on the identifier without selecting it (quoted names and schema.table are included).
  2. Press the configured shortcut.
  3. For templates, DBX replaces every ${table} token with the trimmed selection (using the per-database body when present). For first-N actions, it generates dialect-aware SQL using the selection as the table expression, then executes it.

Example template:

SELECT COUNT(*) FROM ${table}

With orders selected, DBX runs:

SELECT COUNT(*) FROM orders

If there is a selection, DBX uses that text as ${table}. Otherwise it uses the qualified identifier under the caret (including quotes and schema.table). If neither is available, the shortcut does nothing. If the action is scoped to other database types than the current connection, the shortcut is ignored for that tab.

Shortcut Conflicts

DBX checks Quick Action shortcuts against:

  • Other Quick Actions whose database scopes overlap (all-databases counts as overlapping everything)
  • Built-in editor and global shortcuts shown in Settings → Shortcuts

The same shortcut may be reused for different database types when their scopes do not overlap (for example MySQL-only and SQL Server-only). Conflicting bindings are highlighted and block Apply until you resolve them.

Storage, Sync, and Safety

Quick Actions are editor settings stored in the current DBX runtime. On Desktop, Configuration Cloud Sync can synchronize them with your other editor settings. Connection Config Migration only moves database connections and does not include Quick Actions.

A Quick Action only generates SQL; it does not bypass database permissions or DBX production protection. Review the fully expanded statement before running templates that contain writes or DDL, and follow the Production Safety guidance.