# Text to SQL

{% embed url="<https://youtu.be/rua82cEyWZs>" %}

You can access SQL queries and the Text-to-SQL function in the Data Editor in the left hand menu or when choosing a resource for a component.&#x20;

<figure><img src="https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LQ08RFAKZvFADEiXKFy%2Fuploads%2Ft4iHeRCegBgOkuKspwwh%2Fimage.png?alt=media&#x26;token=b5cbe778-aabe-4440-8bde-c03912e5907d" alt=""><figcaption></figcaption></figure>

Then click on the Translate Text to SQL button, and describe the query that you want in the text box and click To SQL. After that, click on the Send Request button to see a preview of your query.

<figure><img src="https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LQ08RFAKZvFADEiXKFy%2Fuploads%2FcNXKcFKaHDoNVobGiObX%2Fimage.png?alt=media&#x26;token=a65ea36b-97f6-4a13-8170-b6d8d402c628" alt=""><figcaption></figcaption></figure>

One of the most common errors in AI-generated SQL queries is incorrect field names. Jet Admin's built in Resource navigator will help you correct these, even if you aren't sure of the exact names yourself. Also, you will want to check that any values are correctly entered. In my example, the correct value is "Cash," but the generated value was "cash". Once I've corrected this, the query works perfectly.

<figure><img src="https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LQ08RFAKZvFADEiXKFy%2Fuploads%2F0GQ76HqNTej37q6is6wB%2FUntitled%20(6).gif?alt=media&#x26;token=4e703b3d-51fd-4be9-aa2b-b2927b24623f" alt=""><figcaption></figcaption></figure>

When your query is working correctly, click the Save button.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.jetadmin.io/user-guide/data/text-to-sql.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
