> 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/make-a-sql-query.md).

# Making SQL queries

An overview of SQL request with PostgreSQL

To quickly configure the display of your data from a database, you can build SQL queries by selecting Custom SQL.

### Open SQL Query Builder

You can open the SQL Builder directly from the component simply by selecting the SQL resource. The SQL Builder will be opened automatically in case you do not create any collections yet, otherwise you will need to select Make SQL Query from the list of collections for your SQL resource:

![](https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ08RFAKZvFADEiXKFy%2F-MjehuplWWd6OK_2hI_D%2F-MjeidvxKZ6geBub4A1n%2Ftestgif42.gif?alt=media\&token=36bfd635-665e-492a-942f-108a64ea512a)

For a complete example with test cases, follow [Use dynamic SQL inputs](/user-guide/sql-queries-and-api-requests/use-dynamic-sql-inputs.md).

### Pass Inputs

To pass [values](/classic-app-builder/binding-and-values/parameters.md) from SQL Query Builder, such as `id`or `email`, you need to specify them within the Inputs tab:

![](https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ08RFAKZvFADEiXKFy%2F-MjehuplWWd6OK_2hI_D%2F-MjeisIsNwvdh6JOrgjr%2Fimage.png?alt=media\&token=4be7a963-9d44-4529-89e3-e31b232132df)

### Use inputs in the query

For example, you need to select data with a specific `id` or `email`from the table, you can make an SQL query and use the parameters:

![](https://3448227606-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LQ08RFAKZvFADEiXKFy%2F-MjZ3LfsU1ZReomd0nUz%2F-MjZ6Tonqdbn2e2wxgfC%2Ftestgif13.gif?alt=media\&token=df427cc1-c46f-4611-a8fd-750ad9a8e016)

### Migrating from old Inputs syntax (before Jet Admin v2.4.0)

Since **Jet Admin v2.4.0** we have changed the way how parameters are inserted in SQL query. Now you don't need to surround parameter value with quotes. **Previously saved queries will continue to work, but you will need remove unnecessary quotes when you will be changing the query (or use compatibility flag described below).**

```sql
SELECT * FROM people WHERE 
city = {{params.city}} 
AND age >= {{params.age}} 
AND name ILIKE {{'%'+params.search+'%'}}

-- Before Jet Admin v2.4.0

SELECT * FROM people WHERE 
city = '{{params.city}}' 
AND age >= {{params.age}}
AND name ILIKE '%{{params.search}}%'
```

You can use **compatibility flag** if you want to stay with old parameters syntax, but it will be deprecated at some moment. Just insert the following option at the top of the query.

```sql
-- @JET_QUERY_VERSION=1
SELECT * FROM people WHERE city = '{{params.city}}'
```


---

# 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/make-a-sql-query.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.
