Connect data
SQL Query
Explore a connected database with SQL, with AI to help write and explain queries.
Run a query
SQL Query is in Data Studio. Choose a connection, write a query and run it.
Browse the schemas, tables and columns of the connection while you write.
Results come back as a table, with the row count and how long the query took.
A row limit keeps an exploratory query from returning a whole table.
Only connections that are marked as available in SQL Query appear here. See Database connections.
Ask the AI
The assistant in SQL Query can:
Write SQL from a question in plain English.
Explain a query you did not write.
Fix a query that failed, using the error message.
It is given the tables of the connection you are on, so it can use your real table and column names. Which models it may use is set in AI settings.
Save and reuse
Saved queries keep a query you will run again.
History lists the queries you ran earlier.
Create a dataset from a query turns the query into a virtual dataset, ready for visuals.
Templates
Queries can use Jinja templates, which let one query take values in when it runs. This is the same templating that visuals use.