Understanding SQL Breakdown
When you click "View SQL" on an answer, Wren AI offers a comprehensive breakdown of the SQL query generation process using Common Table Expressions (CTEs) step by step. This allows you to grasp the underlying logic of the data retrieval.
Result Steps
Wren AI breaks down complex queries into logical steps, showing:
- The rationale for each transformation
- The intermediate SQL statements
- A preview of the query results
Intermediate SQL
For each step, you can view the corresponding SQL statement to understand exactly how the data is being queried.
Preview results of each step
For each step, you can preview the results of the query to understand how the data is being transformed, and you can preview up to 500 rows of data at each step.
The Final Step
The final step shows the complete SQL query that produces your result. You can:
- Preview the final result
- View the full SQL statement
- Switch between different SQL dialects based on your data source
- Copy the SQL for use in other tools
Preview the final result
You can preview the final result of the query to see the data that is being retrieved.
View Full SQL
You can click the "View Full SQL" button to view the full SQL statement. You could see the CTEs and comments in the SQL.
Switch SQL Dialect
If you are connecting from your own data source, you can click the button in the top right to switch to the SQL syntax supported by your data source.