Filter and sort without SQL
You want the rows of one table that match something, in an order that helps. A table’s Data tab filters and sorts for you, and shows the SELECT it ran.
Filter rows
Section titled “Filter rows”- Open the table and go to its Data tab.
- Click Filter in the table’s toolbar, or press ⌘⇧F on macOS, Ctrl+Shift+F on Windows and Linux. The filter bar opens.
- Click Add filter.
- Choose a column, an operator and a value, then click Add.
The filter shows as a chip in the bar, such as status = refunded, and the grid reads the rows again. Add more filters the same way. A row must match every filter to show.
Filter, Add filter, then a column, an operator and a value.
The count under the grid is of the matching rows: 200+ rows while more are still to load, and the exact count once every row has loaded. The table’s estimated size, such as ≈48,200 rows, shows only when no filter is on.
| Operator | Matches |
|---|---|
= |
the value exactly |
≠ |
any other value; rows with no value don’t match |
contains, starts with |
the value anywhere, or at the start, ignoring case |
>, ≥, <, ≤ |
values above or below it |
is NULL, is not NULL |
no value, or any value |
To remove a filter, click the cross on its chip. The Filter button shows how many filters are on, even while the bar is hidden.
Filter by a value you can see
Section titled “Filter by a value you can see”You don’t have to type the value.
- Right-click a cell and choose its Filter item, for example
Filter: status = paid. A cell with no value offersFilter: status is NULL. - In the row panel, open a value’s menu and choose Filter to, for example
Filter to status = paid.
Click a column’s header to sort by it, smallest first. Click again to sort largest first. Click a third time to clear the sort.
One column sorts at a time: clicking another header sorts by that one instead.
See the SQL
Section titled “See the SQL”In the filter bar, click Show SQL. The statement the grid ran appears under the bar:
SELECT *FROM public.customersWHERE email::text ILIKE '%@example.com%'ORDER BY created_at DESC, idLIMIT 200 OFFSET 0Some things to know when you read it:
- Alcuin adds the table’s key after your sort, here
id, so the rows come back in the same order every time and paging never skips or repeats a row. - The grid reads a page of rows at a time, here 200. Set how many in Settings, under Rows per page.
contains,starts withand≠compare the column’s text, so they work on any type. Incontainsandstarts with, a%or_in your value is matched as itself, not as a wildcard.=compares in the column’s own type when the value fits it, such as a whole number for anintegercolumn or a UUID for auuidcolumn, so an index on the column can find the rows. Otherwise it compares text.- Your values are sent to the server separately from the statement. They are written inline here only so you can read it.
Copy the statement into a query tab to take it further. See Write and iterate on a query.
What success looks like
Section titled “What success looks like”The grid shows only the matching rows, in the order you chose. Your filters and sort stay with the tab: close Alcuin and open it again, and the table tab comes back filtered and sorted as you left it.
If it didn’t work
Section titled “If it didn’t work”No rows match these filtersmeans nothing matched. When Postgres has an estimate, it also says about how many rows the table has in total. Click Clear filters, or remove one filter at a time to see which one rules the rows out.=on text must match exactly, including case. Usecontainsto ignore case.- A value that is NULL is not the text
NULL. Useis NULLto find it. See NULL, empty strings, time zones and big numbers. - On a large table,
containsusually reads every row. If the grid is slow to fill, see Find out why something is slow.