# Query Builder

#### **Table**

In this section, you can configure the table on which the query needs to be executed. You will see a list of all the tables created under the selected environment.

#### Query Action

This section allows you to select the action type for the query, which could be `SELECT`, `UPDATE`, `INSERT`, or `DELETE` based on your needs:

* **SELECT**: Used when you need to retrieve data from a table, potentially with specific columns.
* **INSERT**: Used to insert a new entry into the table. You can configure this to fit the data you need to add.
* **UPDATE**: Used to modify an existing entry in the table, typically for a specific item or based on a condition.
* **DELETE**: Used to remove an entry from the table, either for a specific item or based on a condition.

#### Select Columns

This section is visible only when the **SELECT** query action type is chosen. It allows you to select which columns should be returned from the query. You can configure this section to specify only the data you want to retrieve

<figure><img src="/files/QTBZZ6rnQf0P7gfO9Gte" alt="SELECT query section"><figcaption><p>SELECT Query Section</p></figcaption></figure>

#### Insert Columns

This section is used when configuring an `INSERT` query. Here, you can select the columns that will receive values when a new entry is added to the table.

To add a column, click the **Add** button. You can configure the values for each selected column, and these values can also be dynamically sourced by clicking the plus (+) icon next to the input field. This will load the data source model, allowing you to pull in data from other sources or requests during execution.

<figure><img src="/files/i6IILBMQo9uqF5hcDjgP" alt="INSERT query section"><figcaption><p>INSERT query section</p></figcaption></figure>

#### Update Columns

This section is similar to the **Insert Columns** section but is used for `UPDATE` queries. Here, you can specify the columns that need to be modified in an existing entry.

To add a column for updating, click the **Add** button. Configure the values for each selected column, which can also be dynamically sourced by clicking the plus (+) icon next to the input field. This will load the data source model, allowing you to pull in data from other sources or requests at the time of execution.

<figure><img src="/files/Sq8islK86wZXQkeM9CEt" alt="UPDATE query section"><figcaption><p>UPDATE Query Section</p></figcaption></figure>

#### Condition

In this section, you can define the conditions under which the query should be executed.

For example, if you need to retrieve a user whose email is `contact@fireapis.com`, you would configure the following:

* **Table**: `user`
* **Query Action**: `SELECT`
* **Select Columns**: Choose which columns to return (e.g., `name`, `email`, etc.)
* **Condition**: Set the condition to check if the email equals `contact@fireapis.com`.

Dynamic values for the condition (e.g., the email) can be configured by clicking the plus (+) icon next to the input field. This will load the data source model, allowing you to pull dynamic data from the request or other sources when the logic is executed.

<figure><img src="/files/FHvGRYLVlfE4RmYDDl32" alt="DELETE query section"><figcaption><p>DELETE Query Section</p></figcaption></figure>

Below, we have added a few video explanations for your reference.


---

# 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.fireapis.com/the-basics/logics/actions/query-builder.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.
