# SQL Editor

The **SQL Editor** can be used to write SQL statements.

To access, click on the **SQL Editor** icon or dropdown list item:

<div align="left"><figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-84c662f2b269c7f5659b169205ae150f5ec724c1%2Fsqleditor1.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure></div>

Click on the **Objects** tab to expand your database table(s) and fields:

<figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-15698c658b824ef67aab427695ecd3e589ad3615%2Fsqleditor3.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure>

Right-click on the table name, then select the type of SQL query you want to create, e.g. *Generate Select*:

<figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-bb4c6379fbf26c6a76ba80c92b090cad6fa136f3%2Fsqleditor4.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure>

The main frame will now display your generated SQL query, which can be edited if required, by either typing out the statement or by including specific variables from the Variables list:

<figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-c22b9b5e0d06373b76e1eaec0672e357c6de6514%2Fsqleditor5.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure>

To include a variable in your SQL statement:

* place your cursor at the position in your statement where the variable must be added
* then click on the **Variables** tab (if not already selected)
* double-click on the required variable, which will then be added to your statement.

  <figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-f1dcbd67a92df5bdc0659866ea71369b37676d5c%2Fsqleditor7.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure>

Click the **Test** tab to test the execution of your SQL query:

<figure><img src="https://3338214469-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1nxDeDH8GVCXb0XelqGm%2Fuploads%2Fgit-blob-a20a75db9d8e7c2e910aa71b4461afa4b539cf2c%2Fsqleditor8.png?alt=media" alt="SQL Editor"><figcaption></figcaption></figure>

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

### Links <a href="#links" id="links"></a>

***

[Linx Community: SQL Query Builder](http://community.linx.software/t/sql-query-builder/392)


---

# 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.linx.software/reference/plugins/database/shared-properties/sql-editor.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.
