# SQL Editor

Acho Team understands that sometimes the desired data transformation action to be performed is just too complex or inefficient to be done via a sequence of available actions. This is why Acho offers a SQL editor to allow our advanced users proficient in SQL to have the flexibility to perform more advanced actions. The SQL Editor on Acho supports [standard SQL syntax](/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-sql-queries.md) and [functions](/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-math-functions-in-formula.md).&#x20;

![](/files/-McBeQ5dOie12XP18_Cg)

### **Troubleshooting**

1. The SQL Editor does not support lin&#x65;**-**&#x6C;evel execution. That is, everything in the editor will be executed all at once. Therefore, please make sure to include a semicolon `;` at the end of the query and not to have empty lines after the semicolon `;`. Also, the SQL Editor cannot include more than two queries at a time, that is, more than two semicolons `;`.
2. All table names must have a prefix of `SQL_EDITOR_` and a suffix of `_TABLE`.
3. When using the `JOIN` or `UNION` statements, you have to [import all needed tables](broken://pages/-MBfI4djiuZ6kAFNUPVV) into the project first. The SQL Editor can only access tables within the current project.
4. when using the  `JOIN` statement, if there are two columns with the same name, the query will run into an error. join a table to itself. For example, if you join a table to itself (that is `SELF JOIN`) and select all columns, then an error occurs due to duplicate column names.

```
SELECT *
FROM SQL_EDITOR_us_states_TABLE AS A
LEFT JOIN us_states AS B
ON A.state_name = B.state_name 
```

You have can change your query like the following.

```
SELECT A.state_name AS state_name, B.state_name AS state 
FROM SQL_EDITOR_us_states_TABLE AS A
LEFT JOIN us_states AS B
ON A.state_name = B.state_name 
```

#### Learn more supported SQL queries:

{% content-ref url="/pages/-MHIisnHyWP1jUKuQ8UU" %}
[SQL Editor Queries](/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-sql-queries.md)
{% endcontent-ref %}

{% content-ref url="/pages/-MIG8BN2WIs1tFt8v2kK" %}
[All functions in Formula/SQL](/acho-studio/data-prep-projects/applying-actions/tools/sql-editor/supported-math-functions-in-formula.md)
{% endcontent-ref %}


---

# 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.acho.io/acho-studio/data-prep-projects/applying-actions/tools/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.
