Sometimes you want the rows themselves, not a written answer — a list to check, a table to export, a query you can tweak. The SQL console turns a question in plain words into SQL (the language databases are queried in), tells you how it understood you, and lets you edit and run the query over the datasets picked in your conversation. You don’t need to write SQL yourself, though you can.
What you’ll need
- The SQL console, if your plan includes it.
- Datasets picked in the conversation — see Datasets.
Open it
Click the terminal icon in the chat header — the console opens, titled tsql.
Use it
- The Datasets chips are the datasets picked in this conversation. Click one to insert it into
your query;
{{clickstream}}is your event stream. To pick datasets, use the controls under the message box. - Type a question — for example “orders per week by channel, with the refund share” — and click Draft SQL. The first question on a new pick can take a minute.
- Read What I understood: the reading it took, what is counted, its assumptions, anything Not in your data, and what to Check before trusting.
- Edit the SQL if you like, Check it, then Run.
- Results come 100 rows a page. Count rows gives the total.
How to tell it worked
Rows appear under the query, a page at a time, and Count rows tells you how many there are in all.
Good to know
- A query is one read-only
SELECT(aWITHis allowed), over the picked datasets only, joining up to 8 of them. Read-only means it can look at your data but never change it. - Queries that would be too expensive are refused, and the console tells you why.
- Paging stops at row 10,000. If you need more, narrow the query or aggregate it (count or sum by group) instead.
- A query reads each dataset at the same version the chat reads, so the console and your answers agree.
Related
- Data home and lineage — run SQL on any dataset and keep your queries.
- Datasets — pick what the console can read.
- Ask Crunch about your data — get a written answer instead.