# Query Editor

The Query Editor is a powerful, integrated environment for database developers and administrators. It provides a comprehensive set of tools for writing and debugging SQL and analyzing query results, all from a single interface.

This procedure outlines the steps required to access and utilize the Query Editor within the Workspace section of Enterprise Manager UI.

1. From the main Workspace screen, click the "Run Queries" card.\\

   <figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-d8c1fdb13c3956a6833e5243f0cd0a65f06f8664%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
2. In the "Connect to..." dialog, select your target server, enter your credentials, and click Connect.\\

   <figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-2ac9793fc6931226e9ed4252eb8d23d3c6daae9c%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
3. Upon successful connection, the main [Query Editor worksheet](https://github.com/mariadb-corporation/mariadb-docs/blob/main/tools/mariadb-enterprise-manager/usage/workspace/broken-reference/README.md) will appear, ready for you to begin.\\

   <figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-8376219d224182cce66f9cb4d355b2b0164c9aab%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

## Query Editor Worksheet

The Query Editor Workspace is organized around a flexible, multi-tabbed interface designed for parallel work. At the top level, **Worksheet tabs** represent your connections to different database servers. Within each worksheet, you can open multiple **Query Tabs**, allowing you to write and execute several independent SQL statements without losing your context.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-a01ff8d2e492dfcfc909aeb75475ee108198849a%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

### SQL Code Management Features

These features are designed to make writing and managing SQL code efficient and intuitive.

#### **SQL Editor**

Write, run, and debug SQL statements. The editor supports executing queries in parallel across multiple **Query Tabs**, allowing you to work on different tasks or connect to different servers simultaneously within isolated sessions.

#### **SQL Code Completion**

Speed up query authoring and minimize syntax errors with context-sensitive suggestions. As you type, the editor offers relevant SQL keywords, functions, and objects (like tables and columns) from the currently selected database schema.

#### **SQL Code Formatter**

Improve readability and maintain consistent coding standards by automatically formatting your SQL code. Access this feature via the editor's context menu or command palette (`F1`).

#### **SQL Syntax Highlighting**

Enhance code clarity with color syntax highlighting. Different parts of your SQL statements (keywords, strings, comments) are displayed in distinct colors, making queries easier to scan and debug.

#### **SQL Snippets**

Save frequently used SQL code blocks for quick reuse across sessions. Press `CTRL+D` (or `CMD+D` on Mac) to save the current content of the editor as a snippet.

#### **SQL History**

Keep track of every query executed within the Workspace. The **History** tab provides a running log, allowing you to quickly find, review, and re-execute previous commands.

#### **Multiple Connections**

Define and manage connections to various database servers (e.g., development, testing, production). Each connection opens in its own top-level **Worksheet tab**, within which you can open multiple **Query Tabs**.

#### **Open/Edit/Save SQL Files**

Load existing SQL scripts from your local machine into the editor, make changes, and save them back without leaving the workspace.

### Data Management and Analysis Features

These features help you interact with and understand the results of your queries.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-27a10c148a71e7a5b2091ee9d9dd595b79680d8b%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Export Result Sets**

Easily share or archive query results. You can export data grids directly into common formats like `CSV`, `JSON`, or as `SQL INSERT` statements.

{% stepper %}
{% step %}

#### From results tab, click Export Results

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-1f9b445b240098b4611e66bb0f4fcf0b35ea4f86%2Fimage%20(4).png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

#### From Export results window, make the selection.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-a7c2aa7ae17a54b6692d12d801d8af4d90cf2bcb%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

| Setting              | Description                                                                                                              |
| -------------------- | ------------------------------------------------------------------------------------------------------------------------ |
| File name            | The name for the downloaded export file. A default name with the current date is usually suggested.                      |
| Fields to export     | Allows you to select which columns from the query result set to include in the export.                                   |
| File format          | Choose the output format: `CSV`, `SQL`, or `JSON`.                                                                       |
| *CSV Options*        |                                                                                                                          |
| Fields terminated by | The character used to separate values (e.g., `,` or `\t`).                                                               |
| Lines terminated by  | The character indicating the end of a row (e.g., `\n`).                                                                  |
| NULL replaced by     | How `NULL` values should be represented (e.g., `\N`).                                                                    |
| With Headers         | Checkbox to include column names as the first row.                                                                       |
| *SQL Options*        |                                                                                                                          |
| Export option        | Choose whether to export `Both structure and data`, `Data only` (INSERT statements), or `Structure only` (CREATE TABLE). |
| *JSON Options*       | None                                                                                                                     |
| {% endstep %}        |                                                                                                                          |

{% step %}

#### Click Import

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-479a559bab9f640a5b3579569ffac08c2b7a4251%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>
{% endstep %}
{% endstepper %}

#### **Display multiple Result Sets**

When executing a script with multiple `SELECT` statements, view each result set in its own dedicated grid within the Results panel for easy comparison.

#### **Vertical Results Mode**

Improve readability for tables with many columns by displaying results in a vertical, record-by-record format.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-33e36fc3429dfee33aa18f0fa2aa3898a56e4aed%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Result Set Limits**

Control the number of rows returned by `SELECT` statements (default: 10,000). This safety feature keeps queries responsive and can be adjusted per role.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-205fff1a9dc1fb6a6483dfb2d30f1495a2ceb187%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

#### **Result Visualizations**

Gain quick insights from your data by visualizing query results directly within the Workspace as simple **line, bar, or scatter charts**.

#### **Grid Operations**

Interact directly with the data displayed in the Results grid. Perform actions like **searching** for specific values, **filtering** rows, **grouping** data, and customizing column visibility without writing additional SQL.

<figure><img src="https://2850516351-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkuTXWg0NDbRx6XUeYpGD%2Fuploads%2Fgit-blob-893bb872d34885fdb34ce78b911f11274b3b13e5%2Fimage.png?alt=media" alt=""><figcaption></figcaption></figure>

<sub>*This page is: Copyright © 2025 MariaDB. All rights reserved.*</sub>

{% @marketo/form formId="4316" %}
