Help › Run queries
Run a query with parameters
Write a statement with placeholders, enter their values in the Parameters dialog when you run it, and know how the values reach the database.
Querlyn 0.1.0 is not released yet. This help describes it ahead of release.
A statement can leave a value open with a parameter, such as :city. When
you run it, Querlyn asks for the value first.
SELECT id, name
FROM customers
WHERE city = :city
AND created_at >= :since;
Enter the values
- Run the statement as usual. The Parameters dialog opens, with one row for each parameter, in the order they first appear.
- Type each value.
- Press ↩ on macOS or Enter on Windows and Linux, or choose Run. ⎋ on macOS or Esc on Windows and Linux, or Cancel, closes the dialog and runs nothing. The shortcut that runs a statement (⌘↩ on macOS or Ctrl+Enter on Windows and Linux) also runs what waits in the dialog.
The dialog shows the statement that is about to run, and says how the values will reach the database.
A name written several times is asked for once. Each ? is a parameter of
its own, labeled ?1, ?2 and so on. When you run several statements at
once, a name is asked for once for all of them.
Explain asks in the same way; its dialog is titled Parameters for Explain.
Say what kind of value it is
Each row has a button for how the text you typed is read:
| Kind | The text is sent as |
|---|---|
| Auto | A number when it is written as one, otherwise text. The button shows which. 00123 and +44 have a leading zero or sign that a number would lose, so they stay text. |
| Text | Text, always. |
| Number | A number. If the text is not a number, the dialog says so and nothing runs. |
| Boolean | True or false. |
Tick NULL to send NULL. An empty field is the empty text, not NULL.
There is no kind for dates. Type a date as text, such as 2026-10-07, and
the database converts it when it compares it with a date column; or write a
cast in the statement.
Which placeholders count
Querlyn asks only for the forms that mean a parameter in the tab's database:
| Database | Parameters |
|---|---|
| PostgreSQL, Amazon Redshift | $1, :name |
| MySQL, MariaDB | ?, :name |
| SQLite | ?, ?1, :name, @name, $name |
| DuckDB | ?, $1, $name |
| SQL Server | ?, :name |
| Oracle Database | :name, :1 |
| Snowflake | ?, :name |
| BigQuery | ?, @name |
| ClickHouse | {name:Type} |
| MongoDB | None: write the values into the statement |
| Cassandra | None: write the values into the statement |
Things that look similar are left alone: a PostgreSQL cast (::), a
session variable (@total on MySQL and SQL Server), a ? inside a
PostgreSQL JSON expression, and anything inside a string or a comment.
A statement that defines its own parameters is never asked about: creating
a function, a procedure or a trigger, and PREPARE.
How the values reach the database
- On SQLite and DuckDB, the values are bound: they travel beside the statement and never become part of its text.
- On the other databases, Querlyn writes each value into the statement as a literal, quoted the way that database quotes it, and sends the result.
The dialog says which of the two applies.
Either way, the checks that run before a statement (confirmations on Production, read-only) look at the statement with your values in place, because that is what runs.
What is remembered
Querlyn remembers the values you entered for a tab while the tab is open, and fills them in the next time you run. They are kept in memory only:
- not written to disk, to the settings file or to sync;
- not in the query history, which keeps the statement as you wrote it, with its placeholders;
- in the statement console only as a count ("2 values"), unless you turn on Parameter Values there, which is not possible on a Production connection.
Sorting all rows on the server and exporting all rows run the statement again with the values it was run with, without asking.
Turn the dialog off
To send statements exactly as written, choose
, or turn off
Ask for parameter values in Settings under Editor. A ? then
reaches the database as a ?.
Help for Querlyn 0.1.0. All help topics