Skip to main content

Writing queries

The console's editor is built for serious query work. Here's everything it does for you.

Editor features

  • Autocomplete — table names, and column names once a table appears in your FROM/JOIN. Suggestions include field types.
  • Run selection — select part of your SQL and run just that; with nothing selected, the statement under the cursor runs. If a query fails, the cursor jumps to the offending token.
  • Format — tidy up your SQL with the Format button (⇧⌘F).
  • Multiple tabs — each tab keeps its own SQL, results, and history. Great for comparing approaches side by side.
  • Find — search within the editor (⌘F).
  • History — the History drawer lists every run in the current tab; click an entry to restore that SQL.

Run with ⌘Enter / Ctrl+Enter.

[SCREENSHOT REQUIRED: Editor with autocomplete suggestions open]

The SQL dialect

Snapshots are queried with the SQLite dialect of SQL. Everything standard works: JOINs across objects, GROUP BY, aggregate functions, subqueries, common table expressions (WITH), window functions, CASE, date and string functions.

-- Accounts with their open pipeline
WITH pipeline AS (
SELECT AccountId, SUM(Amount) AS open_amount
FROM Opportunity
WHERE IsClosed = 0
GROUP BY AccountId
)
SELECT a.Name, a.Industry, p.open_amount
FROM Account a
JOIN pipeline p ON p.AccountId = a.Id
ORDER BY p.open_amount DESC

The row limit safeguard

To keep the console responsive, the Limit 1K rows checkbox (on by default) caps each run at 1,000 rows; a Load more button pages further when a result was cut short. Even with the limit off, very large results are capped at a hard ceiling — the stats strip shows (capped) when that happens. For a full extract, refine the query or download the CSV.

Salesforce-flavored details

  • Boolean fields hold 0/1 — write WHERE IsClosed = 0, not = FALSE (though SQLite accepts both).
  • Dates are stored as text in ISO format, so string comparisons like CloseDate >= '2026-01-01' work naturally.
  • Record Id columns in results are rendered as links to the record in your live org.