Docs/AI Chat

Generate SQL

Next to any SQL console, the same assistant that powers AI Chat works inside the editor: describe what you want and it writes the SQL in place. Use it when you'd rather get a query than have a conversation.

Write a query from plain language

  1. Open a SQL console in Data Explorer and focus the editor.
  2. Press ⌘K (macOS) / Ctrl+K, type a request — top 10 customers by total payments, with their city — and run it.
  3. The generated SQL is written straight into the editor and highlighted in place, with Keep and Revert.
Generated SQL highlighted in the editor with Revert and Keep actions

Because it's the same engine, it can write federated queries across multiple attached sources (a database + a folder of CSVs), not just single-source SQL.

Your existing query is safe. A generated query you didn't want never overwrites the one you had — Revert puts it back.

Rewrite only a selection

Select part of the query first, then press ⌘K: only those lines are rewritten, and the rest is left untouched. Good for "make this join a LEFT join" or "add a date filter to this subquery".

Talk it through instead

⌘K writes for you; ⌘L (Ctrl+L) opens AI Chat with the current query attached, so you can discuss it — "explain this", "why is it slow", "what would break if I changed the join" — and only send it a follow-up when you're ready.

Next