Write, Run, and Save SQL Queries
Use SQL Editor to write or paste Vista SQL, run SELECT / WITH queries, export the grid, and save reusable statements.
Where: Mission Control → SQL Studio → SQL Editor
Route: /missioncontrol/sql/sql-editor
Bridge must be online before Run SQL works — see SQL Studio workflow. To discover tables and copy boilerplate first, use Explore Vista schema and generate SQL.
Open a query tab
- Open SQL Editor.
- If you see No Query Tabs Open, click Create New Query (or select a saved statement from the left SQL Statements sidebar).
- Or click New statement (+) in the sidebar header to open a tab titled New Statement.
You can keep up to 10 tabs. Default blank tab title is Untitled Query. Open tabs and drafts restore in this browser; result grids do not.
Write SQL
In the editor pane:
- Type or paste a query that starts with
SELECTorWITH. - Optional aids:
- Type
@to open magic-template suggestions (detail label Magic Template). Pick a table to insert a ready SELECT scaffold (alias, optional HQ security join / company / month filters when the schema supports them). - Keep Suggestions on for schema-aware completions; turn the switch off to silence them.
- Click Format (title Format SQL (house style)) to reformat the current text.
- Click Copy to copy the full editor contents.
- Type
Status bar shows Lines, Characters, and Ready (or Executing SQL... while a run is in progress).
Run a query
- Leave the editor on a
SELECT/WITHstatement (or highlight the portion you want to run). - Click Run SQL. With a non-empty selection, the button reads Run Selected. While running it shows Executing....
Only statements that start with SELECT or WITH (after trim) are sent. Other statement types do not run from this toolbar.
On failure, the results pane shows Error and the message; expand Show executed SQL if you need the text that was sent. Toast title: SQL execution failed.
Review and export results
After a successful run, the results pane below the editor shows the grid.
| Control | Use |
|---|---|
| Status | Success, No Data, Error, or Executing (plus timing / row count when available) |
| Search results... | Filter rows in the grid |
| Columns | Show or hide columns |
| CSV / EXCEL | Download the current (filtered/visible) grid as sql-results.csv or sql-results.xlsx |
| Fullscreen | Expand or exit the grid (Enter fullscreen / Exit fullscreen) |
| Pagination | Page through large result sets |
Empty grid message: No results to display.
Save and reuse statements
Save
- With SQL in the active tab, click Save.
- Toast Statement saved confirms it. The statement appears under SQL Statements.
Save creates a new private statement from the current tab. After a tab is linked to a statement, further edits auto-save to that statement after a short idle period.
If the tab has no SQL: toast Nothing to save.
Open
Click a statement card (or its ⋯ menu → Open). A linked tab opens (or focuses) with that SQL.
Manage from the card menu
| Action | Result |
|---|---|
| Star | Favorite / unfavorite |
| Rename | Edit the title inline |
| Duplicate | Creates {title} (Copy) and opens it |
| Add to Favorites / Remove from Favorites | Same as the star |
| Delete | Confirm permanent delete, then the statement is removed (linked tabs close) |
Browse the sidebar
| Control | Use |
|---|---|
| Search statements... | Match title, SQL text, or tags |
| Filter (funnel) | All / Favorites / Tags; Sort by Recent, A-Z, or Executions; Clear All Filters |
| Tags | Click a tag chip to filter |
Empty list: No statements yet with Create First Statement. Filtered empty: No statements match your filters.
Tabs
| Action | How |
|---|---|
| Switch | Click a tab |
| Rename | Tab ⋯ → Rename Tab |
| Close | Tab × or ⋯ → Close Tab |
Closing a tab with unsaved changes prompts Discard unsaved changes? → Discard and close or Stay.
Typical sequence
- Confirm Bridge is online.
- Create New Query (or open a saved statement).
- Write or paste
SELECT/WITHSQL (optional:@magic template, Format). - Run SQL (or Run Selected).
- Search, adjust Columns, or export CSV / EXCEL.
- Save when you want the statement in SQL Statements.