> ## Documentation Index
> Fetch the complete documentation index at: https://ngquct-docs-fix-500-query-results.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Data Grid

> Sort, size, hide, chart and copy the rows a table or a query puts in the grid

Most of the grid's controls sit in the status bar beneath it. The view switcher is at the leading edge, the row count in the middle, then the columns, filter and page buttons at the trailing edge.

<Frame caption="Data grid with query results">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/data-grid.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=0cd8454ce303a45e29790103a2863479" alt="Data grid" width="1560" height="960" data-path="images/data-grid.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/data-grid-dark.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=9527d048b7c1bf1b1cf08e8d4ab35a51" alt="Data grid" width="1560" height="960" data-path="images/data-grid-dark.png" />
</Frame>

## Sorting

Click a header to cycle through ascending, descending, and off. `Shift`-click a second header to sort by both. Sorting re-runs the query with a new `ORDER BY`, so it orders the whole table rather than the page in front of you.

To sort on open, set **Default row sort** in [Settings > Data](/customization/data-settings) to **Primary key** or **First column**; out of the box the order is the server's. A click on any header overrides it.

<Warning>
  Sorting on a `BLOB`, `JSON`, or spatial column the server cannot order on fails the query. Sort on another column, or set **Default row sort** back to the engine's order.
</Warning>

## Filtering

The header menu carries two filters that answer different questions.

| Header menu item                                | What it filters                                                                      |
| ----------------------------------------------- | ------------------------------------------------------------------------------------ |
| **Filter Values…**, or the funnel icon on hover | The rows already loaded, without a re-query                                          |
| **Filter with column**                          | The whole table. It adds a row to the [filter bar](/features/filtering) and opens it |

**Filter Values…** lists every value in the column with its count, NULL and empty among them. Select the values to keep and click **Apply**. Filter several columns and a row has to match all of them; **Clear Value Filter** and **Clear All Value Filters** are on the same menu.

<Frame caption="Filter a column by its values">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/0TDhsORsgVLO0zL5/images/value-filter-popover.png?fit=max&auto=format&n=0TDhsORsgVLO0zL5&q=85&s=891b192282f57bf5655574577af3d739" 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-docs-fix-500-query-results/0TDhsORsgVLO0zL5/images/value-filter-popover-dark.png?fit=max&auto=format&n=0TDhsORsgVLO0zL5&q=85&s=be8d6357db9a3d10a8760a4763144980" alt="Value filter popover" width="1560" height="960" data-path="images/value-filter-popover-dark.png" />
</Frame>

A value filter lives as long as the result does: switching view mode or tab keeps it, replacing the result clears it. **Fetch All** keeps it and applies it to the rows it loads.

## Columns

Drag a border to resize a column, or double-click it to fit the content; **Size to Fit** and **Size All Columns to Fit** on the header menu do the same. A fitted column stops at half the visible grid width.

Hide columns from the columns button in the status bar or from the header menu. A hidden column is not fetched, so hiding a large one makes the table load faster; the primary key and the sorted column are fetched either way. On a schemaless store the popover lists every field the grid can draw, including ones that turn up only in later documents.

Widths, order, and hidden columns are remembered per table, scoped to the connection, database, and schema; **Reset Columns** in the popover puts them back. Right-click a header and choose **Display As** to render a column as a UUID, a Unix timestamp, JSON, or PHP serialized data; see [Cell and Row Viewers](/features/json-viewer).

## Foreign keys

A foreign key cell carries an arrow on its right edge. Click it to open the referenced table filtered to the matching row, or right-click for **Preview Referenced Row**, which shows that row in a popover. `Cmd`-click always opens a new tab; otherwise the reference takes over the current tab unless that tab holds a query or unsaved edits.

Step back with the Back and Forward buttons at the leading edge of the toolbar, or **View > Back** (`Ctrl+Cmd+[`) and **View > Forward** (`Ctrl+Cmd+]`). Back restores the table you came from as you left it: same filters, sort, page, and selected row. Each tab keeps its own history, Back never closes a tab, and it is unavailable while a tab holds unsaved edits.

<Frame caption="Foreign key lookup">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/fk-lookup-popover.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=4fb80766d0f6308d7bfb129160442b56" 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-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/fk-lookup-popover-dark.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=e22a4d0f9914d3c7b60b95b56c8ccc82" alt="Foreign key lookup" width="1560" height="960" data-path="images/fk-lookup-popover-dark.png" />
</Frame>

## Inspector

`Cmd+Option+I`, or the button at the trailing end of the toolbar, opens the inspector beside the grid. With a row selected it lists every column with an editor matched to the value; with no row selected it shows the table's statistics. [Cell and Row Viewers](/features/json-viewer) covers both. **Auto-show inspector on row select** in [Settings > Data](/customization/data-settings) opens it whenever you pick a row.

<Frame caption="Row inspector">
  <img className="block dark:hidden" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/cell-inspector.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=2171b353dbe9fc0b47b603d02e66bd4c" alt="Row inspector" width="1560" height="960" data-path="images/cell-inspector.png" />

  <img className="hidden dark:block" src="https://mintcdn.com/ngquct-docs-fix-500-query-results/hA72m8tSnRe3b-ew/images/cell-inspector-dark.png?fit=max&auto=format&n=hA72m8tSnRe3b-ew&q=85&s=8dfb52b5269e4bbcabac41e959924e9e" alt="Row inspector" width="1560" height="960" data-path="images/cell-inspector-dark.png" />
</Frame>

## Find in the loaded rows

`Cmd+F` opens the find bar above the grid. `Return` and `Cmd+G` step forward, `Cmd+Shift+G` back, `Escape` clears the term and then closes the bar. Matching ignores case and accents and runs over the text as displayed; binary and spatial columns are skipped. The counter says which rows were searched:

| What you see           | What it means                                      |
| ---------------------- | -------------------------------------------------- |
| `3 of 12`              | Every row is loaded, so this is the whole table    |
| `3 of 12 on this page` | More rows exist that were never fetched            |
| `No matches`           | Every row is loaded and none match                 |
| `Not on this page`     | None of the loaded rows match, and more rows exist |

**Search All Rows** turns the term into a filter that runs at the database, covering the whole table. It replaces the tab's filters, so it appears only when none are applied; with a filter set, add the term to the filter bar instead.

## Pages and row counts

A table tab pages. The status bar offers 5, 10, 20, 100, 500 or 1,000 rows per page, **Custom…** up to 1,000,000, and **All rows…**, plus First, Previous, Next and Last; `Cmd+[` and `Cmd+]` step pages, and clicking the page indicator (`3 / 12`) jumps to a page number. The size a table opens with is a [data setting](/customization/data-settings).

A large table shows an estimated total prefixed with `~` instead of running a slow `COUNT(*)`. **Count Exactly** beside it runs the real count in the background, and `Cmd+.` cancels that. While a total is an estimate, **Last** and **All rows…** stay unavailable and **Next** works as long as the last page came back full.

A query tab does not page. It stops at the [row cap](/customization/data-settings) instead and offers **Fetch All** to load the rest, and a query carrying its own `LIMIT`, `FETCH FIRST`, or `TOP` is never capped. `Cmd+.` cancels a running query or a Fetch All.

## Copying

Click a cell to select it, drag or `Shift`-click for a range, and click a row number for a whole row. Copy acts on the whole selection.

| Shortcut       | Copies                                        |
| -------------- | --------------------------------------------- |
| `Cmd+C`        | The focused cell, or the selected rows as TSV |
| `Cmd+Shift+C`  | The selected rows as TSV                      |
| `Cmd+Option+C` | The same, with a header row                   |
| `Cmd+Option+J` | The selected rows as JSON                     |

Right-click and open **Copy as** for CSV, CSV with Headers, Markdown, and **IN Clause**, which writes `('a', 'b', 'c')` for a `WHERE col IN (…)`. **INSERT Statement(s)** and **UPDATE Statement(s)** appear when the result comes from a single table, and never on MongoDB or Redis. **Copy Column Values** on the header menu copies one column, one value per line.

Every copy follows the grid as shown: hidden columns are left out, columns keep their current order, and over a cell selection only those columns go out. UPDATE keys its `WHERE` clause on the primary key even when that cell is outside the selection.

## View modes

Switch between **Data**, **Structure**, **JSON**, and **Chart** with the switcher at the leading edge of the status bar, or from **View > Result View**. Query tabs have no Structure mode, the mode is remembered per tab, and [Cell and Row Viewers](/features/json-viewer) covers JSON mode.

### Chart mode

<Info>Needs a [Starter license](/features/licensing).</Info>

Pick a bar, line, area, or scatter chart, then a numeric Y column. X takes row numbers, another numeric column, a date or timestamp column, or a categorical column; an optional text, boolean, enum, or set column splits the result into series. Date and timestamp columns plot on a real time axis, whatever order the rows arrive in. Hover the plot for exact values.

A chart draws the loaded rows, up to 2,000 points, 20 series, and 50,000 inspected rows, and the toolbar says when it hit one: "Showing the first 2,000 points of 8,431 loaded rows". Null, binary, and unrepresentable axis values are skipped and counted. Grid selection, Find, hidden columns, and value filters do not narrow a chart, and the page controls and **Fetch All** stay in the status bar. Chart type and axes belong to the tab and follow the column names, so they survive a page turn, a sort, and a re-run.

## Editing and display

Double-click a cell to edit it. Nothing reaches the database until you save, and [Change Tracking](/features/change-tracking) covers the type-specific editors, the row operations, and what a Save runs.

NULL renders as styled `NULL` text. That text, the date format, row height, row numbers, and alternate row backgrounds are [data settings](/customization/data-settings). Every shortcut the grid answers to, and how to rebind it, is in [Keyboard Shortcuts](/features/keyboard-shortcuts).
