How do I view and update a generated SQL statement in Ask Your Data?

When you interact with Ask Your Data, your natural language queries are translated into SQL statements to retrieve the precise information you need. You have the capability to take control of this process by accessing and reviewing the SQL generated by the platform, which provides transparency into how your data is being queried. You can also modify or even completely overwrite these SQL statements to refine your queries or implement custom logic.

You will also be able to visualize the query structure through an SQL Diagram and, if necessary, revert any changes you've made back to the original system-generated SQL.

Explore how to efficiently view, update, and manage your SQL statements to ensure you get the most accurate and relevant results from your data.

Note: Sub-account administrators can use Ask Your Data (AYD) directly within their own sub-accounts, where AYD is scoped to display only the data relevant to that specific sub-account.

How do I view and update a generated SQL statement in Ask Your Data?

How do I view and update a generated SQL statement in Ask Your Data?

1. Open More Options

To view and update a generated SQL statement, click the More Options icon.
Open More Options

2. Open SQL

Click the Show SQL link.
Open SQL

3. Change SQL

Close the SQL view.
Change SQL

4. Change SQL

The SQL generated from the chatbot is displayed in a separate window. You can make changes to the SQL or overwrite it.
Change SQL

5. Save SQL

After changing the SQL, click the Save SQL button.
Save SQL

6. Open SQL Diagram

To view the SQL Diagram, click the SQL Diagram tab.
Open SQL Diagram

7. View SQL Diagram

The SQL Diagram displays the visual representation of the generated query as an Entity Relationship Diagram.
View SQL Diagram

8. New SQL Displays

The new SQL data is displayed in the chatbot.
New SQL Displays

9. Open SQL

To revert to the original SQL, click the Show SQL link from the More Options icon.
Open SQL

10. Revert to Original SQL

Then, click the Revert to Original SQL button.
Revert to Original SQL
This guide covered how to view and update a generated SQL statement in Ask Your Data.