Help › Explore a database

Open a table's rows

Open a table or view from the sidebar in a table tab, narrow and sort its rows with WHERE and ORDER BY fields, and edit or export them there.

Querlyn 0.1.0 is not released yet. This help describes it ahead of release.

To look at what a table holds, open it from the sidebar. It opens in a table tab: the table's rows in the full grid, with a WHERE field and an ORDER BY field above them.

Open the rows

Do any of these on a table or view in the sidebar:

  • Double-click it.
  • Select it and press ↩ on macOS or Enter on Windows and Linux.
  • Select it and choose Query › Open Data.
  • Right-click it and choose Open Data.

The tab is named after the database and the table, such as shop.orders. When the table is not in its database's default schema, the schema is in the name too: shop.sales.orders. On MySQL, MariaDB and ClickHouse, whose databases are what the sidebar lists as schemas, it is shop.orders. Hold the pointer over the tab for the connection and the table's full name.

A table that already has a tab is not opened twice: Querlyn goes to its tab.

This works for tables, views, materialized views, and the other things that hold rows on your database, such as foreign tables, synonyms and ClickHouse dictionaries.

Narrow and sort the rows

Type in the fields what would follow the keyword in a statement:

FieldTypeFor example
WHEREA condition on the table's columnsstatus = 'open' AND total > 100
ORDER BYThe columns to sort by, with DESC for largest firstcreated_at DESC, id

Press ↩ on macOS or Enter on Windows and Linux in either field to apply both and read the rows again. ⇥ on macOS or Tab on Windows and Linux goes to the other field, and ⎋ on macOS or Esc on Windows and Linux back to the rows. ⌘L on macOS or Ctrl+L on Windows and Linux (Query › Go to WHERE Field) puts the cursor in the WHERE field from anywhere in the tab; Query › Go to ORDER BY Field does the same for the other one. An empty field means no condition, or the table's own order.

Both fields suggest the table's columns, functions and keywords as you type, as the editor does; ⌃Space on macOS or Ctrl+Space on Windows and Linux asks for them. The editor's keys for moving, selecting, deleting, undoing, copying and pasting work in the fields too.

While a field is empty, it offers what you applied in it before for this table, newest first. Choose one with ↑ on macOS or Up on Windows and Linux, ↓ on macOS or Down on Windows and Linux and ↩ on macOS or Enter on Windows and Linux, then press ↩ on macOS or Enter on Windows and Linux again to apply it.

The × in each field empties it and reads the rows again (Command Palette › Database: Clear WHERE Field, Command Palette › Database: Clear ORDER BY Field).

Sort by clicking a column

Click a column's header to sort every row of the table by that column: once for smallest first, again for largest first, a third time for the table's own order. Querlyn writes the column into the ORDER BY field and reads the rows again, so the field and the grid always agree. Sort Ascending and Sort Descending in the header's right-click menu do the same.

Filter by This Value in a cell's right-click menu adds the cell's value to the WHERE field (city = 'Berlin', or note IS NULL for an empty cell) and reads the rows again.

When Querlyn does not run a field

What you type in a field becomes part of a statement, so it must stay a condition or a list of columns. Querlyn does not run it, and says why under the fields, when a field has:

  • a ;, which would end the statement;
  • a string, a quoted name, a comment or a bracket that is not closed, or a bracket closed that the field did not open;
  • a line break;
  • a word that starts another part of the statement, such as LIMIT, UNION, FOR UPDATE or INTO, or another statement, such as DELETE. A column with such a name needs its quotes: "limit".

The cursor goes to the place in the field, and the rows on screen stay.

When the database refuses the statement, its message is shown under the fields, and the rows you had stay on screen. Hold the pointer over the message for its details.

What the bar shows

In the barWhat it is
RefreshReads the rows again with both fields (⌘R on macOS or Ctrl+R on Windows and Linux, Query › Refresh Rows).
Rows 1–500 of manyHow many rows are loaded. "of many" while there are more; Querlyn never counts the table's rows unasked.
Commit, Roll Back and the commit modeShown in manual-commit mode or while a transaction is open, as in a query tab. See Commit and roll back changes.
Compare Data…Compares the table's rows with another table's, matched by key. See Compare the data of two tables.
Open as QueryOpens the statement the tab runs in a new query tab on the same database, without running it (Query › Open Statement in Query Tab).
The connectionIts name and, for Production, Staging and Testing connections, the environment. The tab's name says the database. A Production connection also marks the bar's left edge and the tab in red.

What you can do with the rows

The rows are an ordinary result:

  • The table is not read to its end. The first rows are shown at once and more are loaded as you scroll, so opening a table with millions of rows is quick. See Work with results.
  • Edit the rows, when the table has a primary key or a unique constraint. See Edit rows in a result.
  • Copy, chart and export as for any result, from the bar above the grid.

The statement it runs

The tab runs a statement like this one, written for your database, with names quoted where it needs quotes:

SELECT *
FROM sales.orders
WHERE status = 'open'
ORDER BY created_at DESC

It runs like any other statement: it is checked against the connection's safety settings, listed in the statement console and recorded in the query history.

To start from a query tab instead, right-click the table and choose Query Data in New Tab (Query › Query Data in New Tab): a query tab opens with SELECT * FROM the table and runs it.

Tables of other databases

A table listed under another database of the connection's server opens on that database: its tab works there, whatever database the connection names. See Choose a tab's connection and database.

When Querlyn starts again

Table tabs are opened again at the next start, with what their fields hold, but without their rows: choose Load Rows, or the rows are read when you show the tab while its connection is connected. For a connection whose query history keeps no SQL (Production connections, by default), the fields are not kept, nor what they applied before; see Search the query history.

Opening a table counts as using it: completion then offers it earlier.

Help for Querlyn 0.1.0. All help topics