SQL Editor

A scratchpad for running SQL against any data source, with autocomplete, run selection and formatting. Save what works as a query.

The SQL Editor is a scratchpad for running SQL against any of your data sources. Nothing is saved until you choose to save it, so it’s the place to try things out.

Run SQL

  1. Open SQL Editor in the sidebar and pick a data source.
  2. Write your SQL. Autocomplete suggests keywords, table names and the columns of tables your query mentions.
  3. Click Run, or press ⌘ ↵ (Ctrl Enter on Windows). The result appears below the editor. Drag the divider to give either more room.

To run just part of a script, highlight it: the button changes to Run selection. Beautify tidies the SQL up, with one clause per line and keywords in capitals.

Write SQL for your database

Each data source speaks its own flavor of SQL, and Orcabase sends your SQL to it as written. The main differences you might notice:

Data sourceDialectExample: revenue by month
PostgreSQLPostgreSQLdate_trunc('month', created_at)
BigQueryBigQuery Standard SQLDATE_TRUNC(DATE(created_at), MONTH)
DuckDBDuckDB (close to PostgreSQL)date_trunc('month', created_at)

Every query returns at most 5,000 rows and stops after 30 seconds. For bigger questions, add up in SQL (with GROUP BY) rather than pulling raw rows.

Save it

When a query is worth keeping, click Save as query. It becomes a saved query that you can name, chart and pin to dashboards. See Queries.

Keyboard shortcuts

KeysDoes
⌘ ↵Run the query, or the highlighted part
⌘ SSave (on a saved query’s page)
Ctrl SpaceShow autocomplete suggestions

On Windows and Linux, use Ctrl in place of ⌘.

Something unclear or missing? Troubleshooting covers the common errors, or message us.

↑↓ to move↵ to openesc to close