Write & reuse SQL
Save, reuse, and version SQL scripts
Keep named workspace scripts, saved history, local copies, file revisions, and shared scripts in their intended scopes.
What this feature does
Give a script a name and context, save it in the right library, then review versions before restoring.
When to use it
Use this when keeping named scripts, reusing saved SQL, or reviewing earlier local versions.
Before you start
Local libraries are device-specific. Team libraries need account and API access.
Default shortcuts
Named library entries, saved SQL history, and local files are managed separately; save shortcuts have distinct destinations.
| Action | Windows / Linux | macOS | Focus and effect |
|---|---|---|---|
| Open SQL Script Library | No dedicated default | No dedicated default | Open from AI & Sql Editor or the history-list menu; library entries, saved history, and files are managed separately. |
| Save SQL to saved history | Ctrl+S | ⌘+S | Focus the SQL Editor to save to its workspace saved history; this is separate from saving a .sql file or publishing a team script. |
| Save the SQL file | Ctrl+Alt+S | ⌘+⌥+S | In the SQL Editor, write or choose a local .sql file; check the overwrite destination. |
| Load a SQL file | Ctrl+Alt+Shift+L | ⌘+⌥+Shift+L | Load a local file into the SQL Editor without automatically executing it. |
| Save or revise a Workspace Library entry | No dedicated default | No dedicated default | Save, revise, or restore inside the library dialog; no dedicated default is assigned. Restoration does not run SQL. |
- 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
- Open SQL Editor, then AI & Sql Editor > SQL Script Library.
- Choose a storage scope: workspace, local common history, file version, or team library.
- Save or load a named SQL item and check its tags and environment.
- Compare versions before restoring; loading SQL does not execute it.
What to expect
The SQL is stored in the chosen scope, and loading it only places text in the editor.
Limits and safety
- Local libraries and file snapshots keep up to 100 prior versions.
- Workspace packages do not include SQL libraries or file-version snapshots.
If something goes wrong
- If a saved script is missing, check the active workspace and whether it belongs to history, Workspace Library, or a local file.
- If revision controls are unavailable, confirm that the item has a prior saved version and that the current build supports version history.