> For the complete documentation index, see [llms.txt](https://documentation.astera.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://documentation.astera.com/astera-data-stack-v6/miscellaneous/using-the-query-editor.md).

# Using the Query Editor

Astera Data Integrator provides the ability to create and display multiple queries while connected to different database servers, using the same user interface. The queries written are specific for each type of database. For your reference, a link to the query syntax documentation for each database server is given below.

| **Supported Database** | **Query Syntax**                                                                                                              |
| ---------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| MS SQL Server          | <http://msdn2.microsoft.com/en-us/library/aa372021.aspx>                                                                      |
| IBM DB2                | [http://publib.boulder.ibm.com/infocenter/db2luw/v8//index.jsp](http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp) |
| Oracle                 | <http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/sql_elements.htm#SQLRF002>                                    |
| Sybase                 | <http://infocenter.sybase.com/help/index.jsp>                                                                                 |
| MS Access              | <http://office.microsoft.com/en-us/access/HA101315811033.aspx>                                                                |
| My SQL                 | <http://dev.mysql.com/doc/refman/6.0/en/index.html>                                                                           |

When a query starts, it is not connected to the database. Hence, the *New Connection Information* dialog box is also launched at the same time. You can follow the steps for connecting to a database, for establishing a query connection as the process is the same.

Steps:

1. Click *File > New > Query* or press Ctrl + N. A new query is started and the *New Connection Information* dialog box appears. The *Query* module appears on the *Main Menu*.

{% hint style="info" %}
**Note:** You can also click ![](https://3768133094-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FH4WCHHphSt0ALtMJlqot%2Fuploads%2FlTKCX5LKrbR4tBNF0uk8%2F0.gif?alt=media)on the toolbar and select *Query* from the dropdown.
{% endhint %}

2. Follow steps 1 to 11 for *Connecting to Single Database* to establish a query connection.

You are ready to write query scripts in the *Query Pane*. You can write a new query or use the existing SQL Snippets to build your query. The Data Source Browser provides additional functionality while working with queries. For more information, click *Using Data Source Browser with Queries*. You can view the SQL Snippets window and the Data Source Browser from the Menu bar. Both these windows can be set to *Auto-hide* such that they get attached to one side of the application screen to maximize the *Query Pane*. The window reappears when you mouse over the tab.

Use the command buttons on the *File Toolbar* and the *Query Toolbar* to save, run, modify or search the queries.

## **Working with SQL Snippets**

Astera Data Integrator offers built-in code snippets called SQL Snippets to help you build your query. You can add these snippets to modify a query or build a new query.

Steps:

1. Click *View > SQL Snippets***.** The SQL Snippets window appears.
2. In the *SQL Snippets* window, double-click a code snippet to add it to the active *Query Pane*. The code snippet is displayed in the Query Pane.

You can modify the existing template to write your own query.

{% hint style="info" %}
**Note:** You can also press the shortcut Ctrl + K to add a snippet.
{% endhint %}

The query results can be exported and saved in a Microsoft Excel spreadsheet or a delimited file using the *Export Query Results to Excel* and *Export Query Results to Delimited File* respectively.

To export query results you can:

* Use the commands available in the *Query* menu on the Menu ba&#x72;**.**

OR

* Click the *Export Query* buttons available on the *Query Toolbar*.
  * Click the *Export Query Results to Excel* button ![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2Fdocs.astera.com%2Fprojects%2Fcenterprise%2Fen%2F6%2F_images%2Fimage159.jpg\&width=300\&dpr=4\&quality=100\&sign=c3362a3d\&sv=1) to export the results of the query to a Microsoft Excel Spreadsheet.
  * Click the *Export Query Results to Delimited* **File** button ![](https://documentation.astera.com/~gitbook/image?url=https%3A%2F%2Fdocs.astera.com%2Fprojects%2Fcenterprise%2Fen%2F6%2F_images%2Fimage160.jpg\&width=300\&dpr=4\&quality=100\&sign=d9dcdcad\&sv=1) to export the results of the query to a Delimited file.

OR

* Right-click in the *Query Pane* and select the desired command.


---

# 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://documentation.astera.com/astera-data-stack-v6/miscellaneous/using-the-query-editor.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.
