Last updated: 2026-02-12

Query Editor

Write, execute, and analyze SQL queries with Jam SQL Studio's powerful query editor. Get IntelliSense suggestions, view multiple result sets, analyze execution plans, edit results inline (UPDATE), and export results to various formats.

Writing Queries

The query editor provides a full-featured SQL editing experience with syntax highlighting and intelligent code completion.

IntelliSense and Autocomplete

As you type, Jam SQL Studio suggests relevant completions based on your database schema and SQL context:

  • Table names - Suggested after FROM, JOIN, INSERT INTO, UPDATE
  • Column names - Suggested after SELECT, WHERE, ORDER BY, or when typing after a table alias
  • SQL keywords - Context-aware keyword suggestions (FROM after SELECT, WHERE after FROM, etc.)
  • Functions - Built-in SQL functions with parameter hints

SQL Snippets

Speed up common SQL patterns with built-in snippets. Type a prefix and press Tab to expand:

  • sel - SELECT statement template
  • selw - SELECT with WHERE clause
  • ins - INSERT statement template
  • upd - UPDATE statement template
  • del - DELETE statement template

You can also create custom snippets in Settings > Snippets.

Snippets management in settings showing custom snippet editor.
Snippets management in settings showing custom snippet editor.

Executing Queries

Run your queries and view results with multiple execution options.

Basic Execution

  1. Write your SQL query in the editor
  2. Press Cmd+E (macOS) or Ctrl+E (Windows/Linux) to execute
  3. View results in the grid below the editor

Execute Selection

To run only part of your query:

  1. Select the SQL text you want to execute
  2. Press Cmd+E / Ctrl+E
  3. Only the selected portion will run

Tip: If you have Format on execute enabled, Jam SQL Studio will still execute only your selection.

Execution Plan Options

Analyze query performance by capturing execution plans:

  • Execute with Estimated Plan - Shows the query plan without running the query
  • Execute with Actual Plan - Runs the query and shows the actual execution statistics
Graphical execution plan showing query operators and data flow.
Graphical execution plan showing query operators and data flow.

Cancelling Queries

To cancel a long-running query:

  • Click the Stop button in the toolbar, or
  • Press Escape while the query is running

Working with Results

Query results appear in a tabbed grid below the editor with powerful viewing and export options.

Multiple Result Sets

When your query returns multiple result sets (e.g., multiple SELECT statements), each appears in its own tab. You can also switch to a stacked view to see all results vertically.

Results grid showing query output with column headers and data.
Results grid showing query output with column headers and data.

Grid Features

  • Column sorting - Click column headers to sort
  • Column resizing - Drag column borders to resize
  • Duplicate column names - When multiple columns share the same name (e.g., SELECT * with JOINs), Jam shows each column separately and displays the source table above the column name (including when running inside a Manual transaction on SQL Server)
  • Copy as CSV - Copy the active result set to your clipboard from the results toolbar
  • Row side panel - Select a row and open the side panel (or double-click a row) to view values in a vertical layout (drag the divider to resize). When results include columns from multiple tables, Jam shows the source table next to each field.
  • Edit results (UPDATE) - Toggle edit mode (pencil icon) to update editable cells inline (requires a primary key in the result)
  • JSON viewer - Click JSON cells to view formatted JSON in a dialog (with a Copy button). If the value is not valid JSON, the dialog shows an error and the raw value as text.
  • Expanded text viewer - Cells with multiple lines (newlines) show an expand icon to open the value in a read-only dialog (with a Copy button and JSON/Text mode tabs)
  • NULL indicators - NULL values shown with distinct styling

Editing Results (UPDATE)

For queries that return rows from a base table with a primary key, Jam SQL Studio can update cells directly in the results grid (similar to DBeaver).

  1. Run a SELECT query that includes the table’s primary key columns
  2. Click the Pencil icon in the results toolbar to enter edit mode
  3. Double-click an editable cell (or use the pencil icon in the row side panel) to edit
  4. Confirm or cancel the edit (in the row side panel, use the confirm/cancel buttons next to the input)
  5. Click Save to apply changes, or Discard to cancel

Notes: This supports UPDATE only (no INSERT/DELETE). Columns without a single source table (computed/aggregates) are read-only. SQLite results are not editable because the driver does not provide source table metadata. If you want to be able to rollback, make sure a transaction is active in Manual/Smart mode before applying changes; otherwise changes execute in auto-commit.

Plaintext View

Switch to plaintext view to see results as formatted ASCII text, useful for copying into documentation or chat.

Each execution replaces the previous plaintext output.

Exporting Results

Export your query results in multiple formats:

  • CSV - Comma-separated values for spreadsheets
  • JSON - JavaScript Object Notation for APIs
  • Excel - Native .xlsx format with formatting
Export dropdown showing available formats.
Export dropdown showing available formats.

Transaction Management

Control how your queries interact with transactions using the toolbar controls. Each query tab has its own independent transaction state.

In Manual and Smart mode, transaction controls are grouped with a subtle shared tint: transaction mode and isolation sit on the first row, and commit/rollback controls sit on the second row.

When the toolbar gets narrow, right-side File/Format/Options collapse first; if space is still tight, Plan/Result/Recent collapse to icon-only buttons.

With two-row transaction controls visible, right-side actions move into that second row beside commit/rollback only after File/Format/Options and Plan/Result/Recent have already collapsed and space is still insufficient.

Transaction Modes

Click the transaction mode button in the toolbar to switch between three modes:

  • Auto (default) - Every statement auto-commits immediately. This is the standard behavior.
  • Manual - A transaction begins automatically on your first query. You decide when to commit or rollback using the toolbar buttons.
  • Smart - Read-only queries (SELECT) run in auto-commit, while data-modifying statements (INSERT, UPDATE, DELETE) automatically begin a transaction.

Commit and Rollback

When a transaction is active in Manual or Smart mode, use the toolbar buttons or keyboard shortcuts:

  • Commit - Save all changes in the current transaction (Cmd+Shift+C / Ctrl+Shift+C)
  • Rollback - Discard all changes in the current transaction (Cmd+Shift+R / Ctrl+Shift+R)

If no transaction is active yet, the toolbar shows a short hint telling you to run a query first to start one.

The status bar shows the current transaction state with color indicators: amber for an active transaction, red for an error state.

Isolation Levels

In Manual or Smart mode, you can set a transaction isolation level per tab:

  • Default - Use the database engine's default level
  • Read Uncommitted - Allows dirty reads
  • Read Committed - Prevents dirty reads (SQL Server and PostgreSQL default)
  • Repeatable Read - Prevents non-repeatable reads
  • Serializable - Full isolation (SQLite only supports this level)

The isolation level applies when the next transaction begins. Changing it during an active transaction takes effect on the next one.

Tab Close Safety

If you try to close a tab with an active transaction, a dialog gives you three choices: Commit and Close, Rollback and Close, or Cancel. When the app quits, all active transactions are rolled back automatically.

The query status bar uses compact 12px text for improved readability during long editing sessions.

Editor Options

Customize the query editor to match your preferences.

Formatting

  • Format SQL - Press Shift+Alt+F to format your SQL code
  • Word wrap - Toggle word wrap for long lines

File Operations

  • Open file - Cmd+O / Ctrl+O to open a .sql file
  • Save file - Cmd+S / Ctrl+S to save
  • Save as - Cmd+Shift+S / Ctrl+Shift+S to save with a new name

File-backed tabs show an asterisk (* filename.sql) in the tab title when there are unsaved changes. The indicator disappears after saving.

Scripts Panel

Use the Scripts panel in the sidebar to manage and reopen your .sql files:

  • Recent - Quickly reopen recently opened scripts
  • Pinned - Pin frequently used scripts for each script workspace
  • Mounted folders - Mount a folder from disk and browse .sql files in a tree
  • Rename mounted folders - Right-click a mounted folder and choose Rename in Jam SQL (label only)
  • Filter scripts - Search across Recent/Pinned and mounted folders

When you open a script from the Scripts panel, Jam SQL Studio uses your current connection context from Object Explorer. If no connection is selected, you'll be prompted to choose one.

AI Chat Sidebar

The Query Editor includes a built-in AI Chat sidebar powered by your locally installed Claude CLI or Codex CLI. Click the AI button in the toolbar to open the chat panel alongside your editor.

  • Ask questions about your SQL, get suggestions, and let the AI interact with your database via MCP tools
  • The AI can update your editor directly using the ui_set_editor_text tool
  • @-mentions — type @ to reference database objects (tables, views, procedures) from the Object Explorer
  • Session continuity — conversations persist across tab switches and session restores
  • Multi-backend — supports both Claude CLI and Codex CLI; switch between them with a segmented control when both are installed

See AI Integrations & MCP for setup details.

Keyboard Shortcuts

Master these shortcuts to work faster in the query editor:

ActionmacOSWindows/Linux
Execute queryCmd+ECtrl+E
Cancel queryEscapeEscape
Format SQLShift+Alt+FShift+Alt+F
Open fileCmd+OCtrl+O
Save fileCmd+SCtrl+S
New query tabCmd+TCtrl+T
Close tabCmd+WCtrl+W
Comment lineCmd+/Ctrl+/
FindCmd+FCtrl+F
Find and replaceCmd+HCtrl+H
Commit transactionCmd+Shift+CCtrl+Shift+C
Rollback transactionCmd+Shift+RCtrl+Shift+R

Ready to Write Queries?

Download Jam SQL Studio and start writing SQL with powerful IntelliSense.