Running SQL Queries
The SQL intent lets you describe a query in plain English and have the AI write and execute it for you. This is ideal for quick data exploration, validation checks, and ad-hoc analysis without creating a permanent model.
Setting Up
Switch the intent selector to SQL. If following the onboarding guide, click "Try This" on the SQL task.
Example SQL Prompts
Try these with the Jaffle Shop dataset:
Simple query:
"Show me the first 10 orders with their status"
Aggregation:
"What's the total revenue by payment method?"
Join + filter:
"Find customers who have more than 3 orders and show their total spend"
Analytics:
"Show the monthly order count trend"
Sending the SQL Prompt
Type your prompt and click Send. The AI generates a SQL query based on your description:
The response includes:
- The generated SQL query — Formatted and syntax-highlighted
- Explanation — Brief description of what the query does
- Run button — Execute the query directly
Executing the Query
Click the Run button to execute the SQL against your database. The results appear in a table view below the query:
The results table supports:
- Column sorting — Click column headers to sort
- Scrolling — Navigate through large result sets
- Row count — See how many rows were returned
When to Use SQL vs Transform
| Use Case | Recommended Intent |
|---|---|
| Quick data exploration | SQL |
| One-off validation checks | SQL |
| Ad-hoc reporting | SQL |
| Building a reusable model | Transform |
| Creating a pipeline step | Transform |
| Persistent data models | Transform |
SQL intent is for temporary queries — the results are displayed but no model is created. Use Transform intent when you want to create a persistent, reusable data model.
Iterating on Queries
You can refine your SQL queries in the same conversation:
"Show me total revenue by payment method"
(AI generates and runs the query)
"Now break that down by month as well"
(AI generates an updated query with the monthly breakdown)
The AI uses the conversation context to understand what you're building towards, so each follow-up prompt builds on the previous one.
Now let's look at some advanced features that will help you get the most out of Visitran AI.