Query Results

Read, copy and edit the results of your queries, and export every row when the result is cut at the row limit.

When you run SQL in a query tab, the results appear below the editor in a grid that works like the table grid: select cells, copy them in several formats and, for simple queries, edit them in place.

Results and summary

Each statement gets its own result. When you run several statements, numbered chips (1, 2, …) let you switch between results. Chips for statements that failed are shown in amber.

The header of each result shows the statement's SQL and a summary:

SummaryMeaning
N rows · X msA query returned rows.
N rows (limit reached) · X msThere were more rows than the row limit.
N rows affectedA write changed rows.
Query OKThe statement ran and returned nothing.
The error messageThe statement failed.

Row limit

Each statement fetches at most 1,000 rows by default. When a result has more, its summary says "(limit reached)".

Change the limit in Settings ▸ Editor & Grid ▸ Editor row limit (from 1 to 1,000,000). The new limit applies to the next run.

To get every row of a large result, export it.

Results are fetched up to the limit and then shown; they don't stream into the grid as rows arrive.

Copying from results

Results use the same selection as the table grid:

  • Click a cell, then ⇧-click, drag or use ⇧ + arrow keys to select a block.
  • ⌘C copies one cell's raw value, or a block of cells as tab-separated text.

The context menu offers Copy and Paste. Copy formats work as in the table grid; see Working with Data.

Editable results

Some results can be edited directly, just like a table.

When a result is editable

A result is editable when its SELECT:

  • Reads from one table.
  • Includes that table's full primary key.
  • Has no joins, aggregates, aliases or subqueries.

Editable results show Editable · <table> in their header. Hover over it for a reminder: "Double-click a cell to edit it; ⌘S commits the changes to <table>."

For example, this result is editable:

SELECT id, email, status FROM customers WHERE status = 'trial';

When a result can't be edited, the header explains why, for example "Read-only result: select columns from…", "This connection is read-only" or "Wait for the query to finish".

Editing cells

  • Double-click a cell, or press Return, to edit it.
  • Paste with ⌘V.
  • Choose Set NULL from the context menu.

The header shows how many changes are pending ("N change(s)"), with Discard and Commit ⌘S buttons.

You can't add or delete rows from a result, and the JSON, date and binary popover editors aren't available here. Open the table to do that.

Committing

Press ⌘S or click Commit ⌘S. The changes go through the connection's safe mode, and the SELECT runs again so you see the saved values. You can also use Commit Changes and Discard Changes from the context menu.

Export a full result

Choose File ▸ Export… (⇧⌘E) with the result selected. Mantidb runs the statement again and writes every row to the file, not just the first 1,000, streaming them in batches.

This works when the result's SQL is a single, read-only statement. See Import & Export for the formats and options.