SqlOtter
← All documentationWrite & reuse SQL

Write & reuse SQL

Write SQL in the editor

Draft SQL against the editor’s own target, then review formatting, completion, search and file actions before execution.

What this feature does

The SQL Editor keeps query text and an execution target together. Editing text does not run it or save a local file.

When to use it

Use it to compose or revise a query while checking the connection and database it would use.

SQL Editor with SELECT * FROM new_ and an open table-completion list of new_table7_copy1 names.
Authentic 2026 Build 1010 editor capture: a table-completion list is open for the unfinished SELECT * FROM new_ text. A suggestion is highlighted, but insertion and execution are not shown; the editor target appears in the separate status crop below.

Before you start

Open the intended workspace and database tab. Keyword and snippet suggestions can work without metadata; table and column suggestions need a matching database context.

Default shortcuts

The listed defaults have different focus and menu owners. Check the active tab and Settings → Shortcuts; no editing key changes the execution target by itself.

Default shortcuts
ActionWindows / LinuxmacOSFocus and effect
Open the SQL EditorCtrl+Shift+U⌘+Shift+UOpen or return to the SQL Editor; check its target and text because opening can refresh both.
Undo / redo text editsCtrl+Z / Ctrl+Shift+Z⌘+Z / ⌘+Shift+ZApply to undoable document edits, without rolling back executed SQL.
Find in SQLCtrl+F⌘+FWith SQL text focused, open its Find panel; other focused controls can route Find elsewhere.
Replace SQL textCtrl+H⌘+HThe default Replace action is defined, but its SQL-editor shortcut path still needs desktop verification. Open Find and expand Replace in the panel.
Format SQLCtrl+Shift+F⌘+Shift+FFormat the editor document text; review the result. Formatting does not execute SQL.
Trigger completionCtrl+Space⌘+SpaceRequest suggestions while SQL text is focused and completion is enabled; system shortcuts can intercept this chord.
Toggle SQL line commentsCtrl+/⌘+/With SQL text focused, add or remove -- on the current line or selected lines.
Delete the current SQL lineCtrl+Y⌘+YWith SQL text focused, remove the current line; this is not another comment shortcut.
Insert a table nameCtrl+Alt+I⌘+⌥+IOpen a chooser over currently open database tabs and insert a qualified backtick name; verify the editor target and dialect afterward.
Open the table-selection listCtrl+I⌘+IIn the SQL Editor, choose from open table tabs and insert that table name; this does not change the execution target.
Save SQL to saved historyCtrl+S⌘+SWith the SQL Editor tab/text active, save to workspace SQL history. Generic Save can prioritize an active table; use the explicit Save To History menu item when unsure.
Save the SQL fileCtrl+Alt+S⌘+⌥+SSave the editor text to a local .sql file. This chord also has a connection-file action elsewhere; use the SQL Editor menu and verify the destination.
Load a SQL fileCtrl+Alt+Shift+L⌘+⌥+Shift+LLoad a local file into the editor; loading does not execute it and can replace the current text.
Check SQL with the local parserCtrl+Alt+V⌘+⌥+VRun Local:SQL Validation where offered. A parser result does not prove server acceptance or query safety.
Hide / restore surrounding panelsCtrl+Shift+Alt+G⌘+Shift+⌥+GToggle the tree, history, AI and result layout around the editor; it does not delete results or history.
Toggle Terminal ModeCtrl+Alt+Shift+T⌘+⌥+Shift+TToggle the editor’s Terminal Mode where supported; Redis keyspaces use their native command path.
Clear editor text / terminal displayCtrl+Alt+L⌘+⌥+LClear normal editor text or the Terminal Mode display according to the active mode.
Close the SQL Editor tabCtrl+Alt+Shift+W⌘+⌥+Shift+WClose the editor tab; review unsaved file text and workspace state before closing.
  • Settings → Shortcuts shows configurable bindings; customized keys take precedence. Fixed dialog keys and mouse gestures may be managed by their own controls.
  • On macOS, ⌘ means Command and ⌥ means Option. Function keys may require Fn. Delete means forward delete (often Fn+⌫ on a compact Mac keyboard); use the menu when Insert is unavailable.

How to use it

  1. Choose AI & Sql Editor → Open Sql Editor (default Ctrl+Shift+U / ⌘+Shift+U). Opening from a current table can fill a short SELECT; review any existing text before changing it.
  2. Draft a read-only query for a demo target, or explicitly load a local SQL file. Use completion or a snippet to insert text, then review the resulting names and syntax.
  3. Use Format SQL for the document or open Find and expand its Replace controls for text edits. Formatting changes the document text; neither action runs SQL.
  4. Before using an execution action, compare the editor’s connection/database status with the intended database tab and Schema. The editor target is carried into execution; a mismatch prompts for confirmation.

Open the editor and check its target

The editor retains an execution target of its own; the currently visible database tab is a separate cue.

SQL Editor status strip showing local_mysql / test, SQL Mode, 18 bytes and editor position.
A separate exact crop from the completion screenshot shows the editor target local_mysql / test. The 18-byte text and position are editor status, not a query result. Historical screenshot; UI icons have been updated.
  1. Open AI & Sql Editor → Open Sql Editor from the intended workspace and database tab. The same entry is available through the SQL Editor shortcut.
  2. Read the editor status area for its connection and database. If the target matters at schema level, check the selected Schema and query text as well.
  3. If opening filled a short SELECT for the current table, inspect or replace that text before continuing. Do not treat the inserted SQL as executed.
  • The editor target is passed into execution. If it differs from the active database tab, the execution path asks whether to use the editor target; declining stops that run.
  • Reopening can refresh the editor target from the active tab, so confirm again after switching context.

Full-screen-style editor layout

Use Clean Other Layout for a full-screen-style SQL editing area inside the workspace window.

SqlOtter SQL Editor with SQL filling the work area, workspace tabs across the top, and the highlighted layout control among the floating buttons at the lower right.
The supplied SqlOtter V1.1.3 Build 29930 screenshot shows an expanded SQL editing area. Workspace tabs and floating controls remain visible. Database icons were updated to the current two-letter marks. Historical screenshot; UI icons have been updated.
  1. Open the SQL Editor and click Clean Other Layout in the floating controls at the lower right, between SQL history and Terminal Mode.
  2. The table tree, SQL history and AI panels are hidden. If query results are already present, the result area is folded too, leaving more room for SQL.
  3. Click the same control again, whose tooltip now says Restore Previous Layout, to restore the earlier panel visibility and dimensions.
  • To maximize the workspace window as well, hold Ctrl while clicking the control (Command on macOS). Restoring the panels does not restore the previous window size.
  • The default Ctrl+Shift+Alt+G / ⌘+Shift+⌥+G shortcut toggles the layout without maximizing. Check Settings → Shortcuts if you have changed the binding.
  • This is a workspace layout, not a separate native full-screen window. The screenshot shows the expanded editing area with the workspace tabs and floating controls still visible.

Draft and format without running

Syntax highlighting and formatting help review a document; neither confirms what the server will do.

  1. Type a read-only query for a demo table or load a reviewed local file. Check any generated table name and dialect-specific quoting.
  2. Choose Format SQL from the editor menu or use Ctrl+Shift+F / ⌘+Shift+F. It formats the whole editor document, so review the resulting text and keep a copy when the original layout matters.
  3. Use Ctrl+/ / ⌘+/ on the current or selected lines to toggle -- comments. Ctrl+Y / ⌘+Y deletes the current line instead.
  • Undo and redo affect document edits; they do not roll back a query already sent to the server.
  • Formatting can rewrite text and may fail for a dialect; it is not a semantic or safety check.

Use completion and snippets

Suggestions can include keywords, functions, saved snippets, and available database objects.

  1. With the SQL text focused, type a prefix or request completion with Ctrl+Space / ⌘+Space when enabled. Choose a suggestion and inspect the inserted text.
  2. For reusable text, configure a snippet trigger in Settings → Snippets, then choose its completion item in the editor.
  3. For a table-name chooser, use Insert Table Name (Ctrl+Alt+I / ⌘+⌥+I) or the open-table list (Ctrl+I / ⌘+I), then compare the inserted name with the editor target.
  • Keyword and snippet suggestions can appear without an active database state. Table and column suggestions use cached or queried metadata from the editor-associated state and can be incomplete.
  • Insert Table Name inspects current open database tabs and emits a backtick-qualified name; the open-table list uses open table tabs. Neither command changes the execution target or guarantees quoting for every dialect.
  • The supplied screenshot shows suggestions for unfinished SELECT * FROM new_; it does not show a candidate being inserted, metadata completeness, or query execution.

Find and replace SQL text

The SQL Editor has a Find panel with an expandable Replace row.

  1. Focus the SQL text and press Ctrl+F / ⌘+F to open Find. The selected single-line text can seed the search input.
  2. Use the panel’s expand control to reveal Replace, review the matches, and apply a replacement deliberately.
  3. Close the panel when finished and recheck the document before execution.
  • Find follows the focused control; pressing it from a table, AI panel or another search input can route elsewhere.
  • The current default Ctrl+H / ⌘+H is assigned to the main Replace action, but the reviewed SQL-editor handler does not establish opening the replacement row. Use the visible panel control until this shortcut has desktop verification.

Keep files and saved history separate

A local SQL file, workspace saved SQL history, and query execution history are different records.

  1. Use AI & Sql Editor → Load from file or the editor’s Load SQL Editor from File shortcut to load a local file; inspect the text and target before any run.
  2. Choose Save To File to write a .sql file to the associated or selected path. Check the destination before overwrite; the prior changed file text is versioned locally by the current implementation.
  3. Choose the editor menu’s Save To History to store the SQL in this workspace’s saved history. Query execution history is a separate Tools entry and is not the same saved list.
  • The default Ctrl+S / ⌘+S belongs to generic Save as well as the SQL-history action. An active content table can take precedence, so use the explicit editor menu item when the destination matters.
  • Loading does not execute SQL; saving history does not save a file or publish to a team library. Recent file paths are scoped to the current workspace.

Treat local checks as hints

Use Local:SQL Validation to inspect parsing before choosing the separate execution action.

  1. Choose Local:SQL Validation in the SQL Editor context menu or use its configured shortcut when available.
  2. Read a parser result as a local SQLGlot check; confirm object names, target, privileges and intended effects separately.
  3. If Check Target Metadata is offered for the target, use it as a metadata hint for tables and columns, then review the actual server response when running.
  • The parser may try a supported fallback dialect. A passed check therefore does not prove the target server accepts the statement or that it is safe.
  • Metadata checks do not resolve every ambiguous column or replace a server-side permission/semantic check.

What to expect

The editor shows the reviewed SQL text and connection/database context. The query remains unexecuted until an execution action is chosen.

Limits and safety

  • Opening or reopening the editor can refresh its target from the active database tab and prefill SQL for the current table. Recheck both target and text before running.
  • Table-name chooser actions inspect current open database or table tabs; inserted backtick names are not proof that the editor target or dialect is correct.
  • Completion depends on settings, metadata and dialect. Local SQLGlot validation checks parsing only; it does not establish server acceptance or safety.

If something goes wrong

  • If table or column completion is empty, check the editor target, available metadata and autocomplete settings. Try a keyword or snippet suggestion to distinguish metadata availability from a disabled completer.
  • If the target differs from the intended database tab, stop before running. Activate the intended tab, reopen the editor if needed, and review its target and text again.
  • If a loaded file appears wrong, confirm it is UTF-8 before saving. Loading replaces editor text; Save To File writes a local .sql file, while Save To History creates a separate workspace entry.