> ## Documentation Index
> Fetch the complete documentation index at: https://flextable-docs-oracle-client-choice.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Query editor

> Write, autocomplete, and run queries; then read, filter, chart, and export the results.

The query editor is where you write and run queries against any connected database: SQL for PostgreSQL, MySQL, and SQLite; shell-style queries for MongoDB; and commands for Redis.

<img src="https://mintcdn.com/flextable-docs-oracle-client-choice/tHXEy7Wr6vLxVTOF/images/04-query-editor/editor.png?fit=max&auto=format&n=tHXEy7Wr6vLxVTOF&q=85&s=bb16345a1124bc42ca8ef80ebf10cdb7" alt="Query editor" width="1496" height="858" data-path="images/04-query-editor/editor.png" />

## Open an editor

Click **+** in the tab bar and choose **New Query**, or use the query icon in the sidebar. The editor knows which connection and database the tab targets, shown in the footer.

## Write with autocomplete

As you type, FlexTable suggests **tables, columns, and keywords** from the live schema.

<img src="https://mintcdn.com/flextable-docs-oracle-client-choice/tHXEy7Wr6vLxVTOF/images/04-query-editor/autocomplete.png?fit=max&auto=format&n=tHXEy7Wr6vLxVTOF&q=85&s=9df6efe1d33e5999b67acd437b5fdb7e" alt="Autocomplete" width="761" height="432" data-path="images/04-query-editor/autocomplete.png" />

<Tip>**Schema-aware.** Suggestions come from the database you are actually connected to, so table names, column names, and types are real.</Tip>

```sql theme={null}
-- PostgreSQL / MySQL / SQLite
SELECT id, email, created_at FROM users WHERE active = true ORDER BY created_at DESC LIMIT 100;
```

```js theme={null}
// MongoDB
db.users.find({ active: true }).sort({ created_at: -1 }).limit(100)
```

```
# Redis
SCAN 0 MATCH user:* COUNT 100
```

## Format your SQL

Reformat a messy statement into clean, readable SQL with one action, so shared and saved queries stay tidy.

## Run and read results

Press **Cmd/Ctrl + Enter** (or the **Run** button) to execute. Results stream into the grid below and large results paginate. The result grid is the same one used for table browsing, so you can **sort**, **filter**, and **inspect** a cell just like a table.

<img src="https://mintcdn.com/flextable-docs-oracle-client-choice/tHXEy7Wr6vLxVTOF/images/03-browsing/filter.png?fit=max&auto=format&n=tHXEy7Wr6vLxVTOF&q=85&s=73898e6be5f442a2af5152857712609d" alt="Result grid with filter" width="1495" height="861" data-path="images/03-browsing/filter.png" />

<Tip>**Cancellable.** A long-running query can be stopped; the **Run** button becomes **Stop** while it executes.</Tip>

## Saved queries and history

<img src="https://mintcdn.com/flextable-docs-oracle-client-choice/tHXEy7Wr6vLxVTOF/images/04-query-editor/saved-queries.png?fit=max&auto=format&n=tHXEy7Wr6vLxVTOF&q=85&s=47ffe004050c1182c9297c54047c7471" alt="Saved queries in the Query Manager, organized into folders" width="1496" height="858" data-path="images/04-query-editor/saved-queries.png" />

Two separate things:

* **Saved queries** - name and save a query, organize saved queries into **folders**, and reopen them later. Save with **Cmd/Ctrl + S** or the Save action in the editor.
* **Run history** - every query you run is logged automatically, separate from saved queries, with its status, duration, rows affected, and timestamp. Open the **history** view (grouped by date) to copy, re-run, or reopen a past query.

## Visualize and export

* **Chart** - switch the result from **Table** to **Chart** to see it as a bar, line, area, pie, or scatter chart. See [Charts](/charts).
* **Export** - save the result as **CSV**, **JSON**, **SQL**, or **Excel**. See [Import and export](/import-and-export).

## Logs

The footer **Logs** tab shows execution details (timing and errors) for the queries you have run.
