The SQL editor

kept in this browser

The SQL editor runs ad-hoc queries against a warehouse, with saved queries, parameters, snippets, and scheduled refreshes.

Checked against the Databricks documentation on · history

On this page12

What it is

The SQL editor is the workspace’s dedicated place to write and run SQL against a warehouse: one statement or several, with results, a query history, and everything needed to save and share a query — no notebook cells, no other language.

Why it exists

Not every workflow needs a notebook’s mix of languages and cell-by-cell execution. An analyst who thinks in SQL and wants to explore a table, save a query, and share it with a teammate benefits from an interface built entirely around that: a single statement box, a results grid, and one-click visualization, with SQL-specific conveniences a notebook doesn’t offer, like parameter widgets and query-level sharing permissions.

How it works

Running queries

Every query runs against a chosen SQL warehouse (see Sizing a SQL warehouse); you can run the whole statement or just the one under the cursor in a multi-statement script, and results come back as a table you can chart, filter, or download directly.

Saved queries and folders

A query can be saved and organized into folders in the workspace browser alongside notebooks and other objects, and reopened later, edited collaboratively, or reviewed through its version history.

Parameters

Prefixing a name with a colon — :region — turns it into a parameter widget: the editor renders an input control (text, dropdown, date, or a dropdown driven by another query) so a value can change without touching the SQL. Each widget has a configurable type, title, and default, set from a gear icon next to it.

Snippets

Frequently reused fragments of SQL can be saved once and inserted into new queries, avoiding copy-pasted boilerplate across similar queries.

Scheduling a refresh

A saved query can be scheduled to re-run automatically; that scheduled result is what an alert (see SQL alerts) or a subscribed dashboard dataset (see AI/BI dashboards) actually reads.

Sharing and permissions

A query has its own permission levels — from viewing results to running, editing, or fully managing it — separate from table-level Unity Catalog grants. Its execution mode matters too: run as viewer applies the person running it own credentials, while run as owner always uses the owner’s credentials, which is how legacy alerts and some jobs keep working even after the original author changes teams.

SQL editor vs. notebook

SQL editorNotebook
LanguageSQL onlyPython, SQL, Scala, R mixed
Unit of workone query, multi-statement scriptscells, run in any order
Best forad-hoc analysis, dashboards, alertspipelines, multi-step logic, orchestration
Sharing modelper-query permissionsnotebook/workspace permissions

Example

A saved query with a parameter widget instead of a hardcoded value:

SELECT customer_id, order_date, amount
FROM sales.gold.orders
WHERE region = :region
  AND order_date >= :start_date;

Common mistakes

  • Writing a multi-step transformation as one long saved query instead of a proper job or pipeline that gets retries and dependencies.
  • Hardcoding a value that changes often (a region, a date) instead of exposing it as a parameter widget, and ending up with several near-duplicate queries.
  • Not noticing a query is set to run as owner, so it keeps running under someone else’s identity long after they’ve moved teams.
  • Treating a query’s schedule as a substitute for a job schedule — it refreshes a result, it doesn’t orchestrate dependencies or retries.
  • Expecting notebook features (multiple languages, cell state) inside the SQL editor.

Check yourself

3 questions on what this page says. Pick an answer, then check it.

  1. 1In a saved SQL editor query, what does writing :region in place of a literal value do?
    Show the answer

    C. It turns the name into a parameter widget, an input control whose value can change without editing the SQL

    A colon before a name makes it a parameter widget, with a type, title and default. That avoids several near-identical queries that differ only by a hardcoded value.

    Read the section again
  2. 2A saved query is set to run as owner. Whose credentials does it use when someone else runs it?
    Show the answer

    B. The owner's, even if the owner has since moved to another team

    Run as owner always uses the owner's credentials, unlike run as viewer. That keeps some alerts and jobs working, but the query may keep running under someone's identity long after they left the team.

    Read the section again
  3. 3What does scheduling a saved query give you, and what does it not?
    Show the answer

    B. It re-runs the query to refresh its result, but it does not orchestrate dependencies or retries

    A query schedule only refreshes a result, which alerts and dashboards can then read. It is not a substitute for a job schedule when you need dependencies or retries.

    Read the section again

Where this sits

Resources

2All resources
Report a problem with this page
What kind of problem?

Reports about "The SQL editor" go to the maintainer, not to a public thread.

Suggest a resource
What kind?

Nothing appears on the site automatically. A person reads every suggestion, checks the link and writes the note that goes with it.