> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-feat-ai-sql-walkthroughs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Grid

> Sort, filter, edit, and copy query results in a spreadsheet-style grid

# Data Grid

Query results and table data open in a spreadsheet-style grid. Sort and filter columns, edit cells inline, and copy in several formats.

<Frame caption="Data grid with query results">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/data-grid.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=61ea54604d670e77fde4ff17acbfc9e4" alt="Data grid" width="1560" height="960" data-path="images/data-grid.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/data-grid-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=d17732c10b6290d0a4ddff596ba45335" alt="Data grid" width="1560" height="960" data-path="images/data-grid-dark.png" />
</Frame>

## View Modes

Switch between **Data**, **Structure**, and **JSON** in the status bar. Query tabs show Data and JSON only. The mode is remembered per tab.

JSON mode shows the rows as a JSON array, with **Text** and **Tree** views. Select rows in Data mode first to limit what JSON shows, then use **Copy JSON**.

## Columns

### Sort

Click a header to cycle through ascending, descending, and off. `Shift`-click another header to add it to the sort, so you can order by several columns at once. Sort re-runs the query with `ORDER BY` appended, replacing any existing one.

To sort on open, set **Settings > Data > Default row sort** to **Primary key** or **First column** (default is **No sorting**). A click on any header still overrides it.

<Note>
  If the sort column can't be ordered on the server (a `BLOB`, `JSON`, or spatial column), the query fails. Pick another column or set the default back to No sorting.
</Note>

### Filter

The header gives you two filters:

* **Filter Values…** (or the funnel icon on hover) filters the loaded rows by picking values, without re-querying. The popover lists each value with its count; search to narrow, check the values to keep, and click **Apply**. NULL and empty values appear as their own entries. `Return` applies, `Escape` cancels. Filter several columns at once and rows must match every filter. Clear from the header menu (**Clear Value Filter**, **Clear All Value Filters**).
* **Filter with column** adds a filter row for that column to the [Filter Panel](/features/filtering) and opens it. Use this to filter the whole table on the server.

<Frame caption="Filter a column by its values">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/value-filter-popover.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=35001430fe5b4474a0a3cfe299b897da" alt="Value filter popover" width="1560" height="960" data-path="images/value-filter-popover.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/Bj1EoTflf_jG6N_3/images/value-filter-popover-dark.png?fit=max&auto=format&n=Bj1EoTflf_jG6N_3&q=85&s=7c1485899b43c37dd769d1c0fd549c75" alt="Value filter popover" width="1560" height="960" data-path="images/value-filter-popover-dark.png" />
</Frame>

<Note>
  Value filters run on the rows already loaded, so they cover the current page only.
</Note>

### Resize and Hide

Drag a column border to resize, or double-click it to fit the content. The header menu has **Size to Fit** for one column and **Size All Columns to Fit** for all of them. Fitted columns stop at half the visible grid width, so one long-text column can't push the rest off screen.

Hide columns from the columns button in the status bar or the header menu. A hidden column isn't fetched, so hiding a large column makes the table load faster. The primary key is always fetched, so editing still works.

Column widths, order, and which columns are hidden are remembered per table, scoped to the connection, database, and schema. Click **Reset Columns** in the columns popover to put everything back to defaults.

### Display Format

UUIDs and Unix timestamps render in a readable form when the column type and name match (for example a `BINARY(16)` column named `uuid`). Right-click a header and choose **Display As** to set the format per column: Raw Value, UUID, Unix Timestamp (seconds or milliseconds), JSON, or PHP Serialized. See [Cell and Row Viewers](/features/json-viewer) for what each format does. Toggle the automatic detection in **Settings > Data > Smart value detection**.

## Editing

<Warning>
  Editing works on simple `SELECT * FROM table` queries. Joins, aggregations, and [Safe Mode](/features/safe-mode) connections are read-only.
</Warning>

Double-click a cell to edit it. Press `Enter` to confirm or `Escape` to cancel. Some types open a dedicated editor:

| Column type                     | Editor                                                                    |
| ------------------------------- | ------------------------------------------------------------------------- |
| Date, time, datetime, timestamp | Calendar and time picker, or edit as text                                 |
| Foreign key                     | Searchable list of referenced values                                      |
| Boolean, `BIT`, `TINYINT(1)`    | Checkbox, with a third state for nullable columns                         |
| `ENUM`                          | Searchable value list                                                     |
| `SET` (MySQL/MariaDB)           | Multi-select checkboxes                                                   |
| `JSON`, `JSONB`, `BLOB`, binary | [Cell viewers](/features/json-viewer); hex editor is read-only over 10 KB |

<Frame caption="Type-specific cell editor">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/date-picker-editor.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=47c152c22a0393de446d0957a017114e" alt="Cell editor" width="1560" height="960" data-path="images/date-picker-editor.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/date-picker-editor-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=2ab6a608bc0a5289d9100ce83cd0525a" alt="Cell editor" width="1560" height="960" data-path="images/date-picker-editor-dark.png" />
</Frame>

Right-click an editable cell and open **Set Value** for common values without typing: **Empty**, **NULL** (nullable columns), **Default** (columns with a default), and date functions like `NOW()` or `CURRENT_DATE` on date columns.

### Foreign Keys

Foreign key cells show an arrow on the right edge. Click it to open the referenced table filtered to the matching row; `Cmd`-click opens a new tab. Right-click for **Preview Referenced Row**, which shows the row in a popover.

<Frame caption="Foreign key lookup">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/fk-lookup-popover.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=4f11c7dade86d8179d9025027b376955" alt="Foreign key lookup" width="1560" height="960" data-path="images/fk-lookup-popover.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/fk-lookup-popover-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=07961d3445958cbfc63c315bef908fed" alt="Foreign key lookup" width="1560" height="960" data-path="images/fk-lookup-popover-dark.png" />
</Frame>

### Row Operations

* **Add** (`Cmd+Shift+N`): click **+** in the status bar or use the shortcut.
* **Duplicate** (`Cmd+Shift+D`): right-click a row and choose **Duplicate**. The primary key resets to `DEFAULT` so the database assigns a new one.
* **Delete**: select rows by their row number (`Shift`-click for a range, `Cmd`-click for separate rows) and press `Delete`.
* **Paste**: copy rows, then right-click and choose **Paste** to insert them as new rows.
* **Fill Column**: right-click a header to set one value across all loaded rows. It skips primary key columns.

### Saving Changes

Edits are queued, not applied right away. The toolbar shows the pending count, modified cells are highlighted, and new and deleted rows are marked.

* **Preview SQL** (`Cmd+Shift+P`): review the statements before applying.
* **Save Changes** (`Cmd+S`): apply all pending changes.
* **Undo / Redo** (`Cmd+Z` / `Cmd+Shift+Z`): step through edits before saving.

There is no discard button. Undo your edits, or let the confirmation prompt drop them when you refresh, re-sort, change filters, or close the tab. See [Change Tracking](/features/change-tracking) for how the queue works.

## Inspector

Toggle the inspector with `Cmd+Option+I`. With a row selected, it lists every column value with full editors for long text and JSON; see [Cell and Row Viewers](/features/json-viewer) for details. Turn on **Settings > Data > Auto-show inspector on row select** to open it automatically.

With no row selected, it shows table statistics: data, index, and total size, row count, average row size, engine, collation, and created and updated dates (fields vary by database).

<Frame caption="Row inspector">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/cell-inspector.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=e976a04a6f40eb369f322377228943cf" alt="Row inspector" width="1560" height="960" data-path="images/cell-inspector.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-feat-ai-sql-walkthroughs/REI9tfF_TGivM099/images/cell-inspector-dark.png?fit=max&auto=format&n=REI9tfF_TGivM099&q=85&s=8eb6a387e54f3c8be6b99664892eb75e" alt="Row inspector" width="1560" height="960" data-path="images/cell-inspector-dark.png" />
</Frame>

## Select and Copy

Click a cell to select it, drag or `Shift`-click for a range, and click row numbers for whole rows. Copy, **Copy as**, and Delete act on the whole current selection, whether that is a cell range, a column (`Cmd`-click its header), or rows picked by their row numbers.

* `Cmd+C`: the focused cell, or the selected rows as TSV.
* `Cmd+Shift+C`: the selected rows as TSV.
* `Cmd+Option+J`: the selected rows as JSON.

Right-click a row and choose **Copy as** for more formats:

| Format                 | Output                                     |
| ---------------------- | ------------------------------------------ |
| With Headers           | TSV with a header row                      |
| JSON                   | Array of row objects                       |
| CSV / CSV with Headers | RFC 4180 CSV                               |
| Markdown               | Markdown table                             |
| IN Clause              | `('a', 'b', 'c')` for `WHERE col IN (...)` |
| INSERT / UPDATE        | SQL statements per row (SQL databases)     |

Copies follow the grid as shown: hidden columns are left out and columns keep their current order. When you select specific cells, **Copy as** (JSON, CSV, Markdown, INSERT, and UPDATE) includes only the columns you selected; select whole rows to include every column. **Copy as UPDATE** still keys its WHERE clause on the primary key, even when the primary key cell is not part of the selection. Right-click a header and choose **Copy Column Values** to copy a whole column, one value per line.

## Pagination and Limits

**Table tabs** page through data. The status bar has a rows-per-page menu (5 to 1,000, a custom size, or **All rows**) and First / Previous / Next / Last controls. Click the page indicator (for example `3 / 12`) to type a page number and jump to it. Set the default page size in **Settings > Data**.

Large tables show an estimated total instead of running a slow `COUNT(*)`. **Settings > Data > Count rows if estimate less than** sets the threshold below which TablePro counts exactly.

**Query tabs** cap results at 10,000 rows by default. Your query is sent exactly as you wrote it; TablePro stops reading once it reaches the cap. A query with its own `LIMIT`, `FETCH FIRST`, or `TOP` is not capped. When the cap trims a result, the status bar shows **Fetch All** to load the rest (with a confirmation, since large results use a lot of memory). Run one query without the cap via **Execute Without Limit** (`Option+Cmd+Enter`). Adjust the cap in **Settings > Data** (**Truncate query results**, **Row cap**).

Press `Cmd+.` to cancel a running query or a Fetch All.

## Display Settings

NULL shows as styled `NULL` text. Set the NULL display, date format, row height, row numbers, and alternate row backgrounds in **Settings > Data**.

## MongoDB Collections

MongoDB has no fixed schema, so TablePro infers columns by sampling up to 50 documents. Missing fields show as NULL, and the `_id` column is read-only (delete and re-insert to change it). BSON values display as `ObjectId("...")`, ISO 8601 dates, `BinData(...)`, decimal strings, and `DBRef(...)`.

Changes preview as shell commands: `insertMany`, `updateOne` with `$set`, and `deleteMany`.
