> For the complete documentation index, see [llms.txt](https://docs.jetadmin.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.jetadmin.io/user-guide/sql-queries-and-api-requests/text-to-sql.md).

# 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&amp;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&amp;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&amp;token=4e703b3d-51fd-4be9-aa2b-b2927b24623f" alt=""><figcaption></figcaption></figure>

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


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.jetadmin.io/user-guide/sql-queries-and-api-requests/text-to-sql.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
