Query parameters

functional

Write :id, ? or $1 where a value goes, type the value above the results, and run without editing the SQL.

Write a placeholder where a value goes, type the value once in the strip above the results, and run. Change the value and run again: the script itself never changes, so a query you reuse every day stays a query you can save, share and keep in version control.

SELECT *
FROM beneficiaries
WHERE id = :id;

As soon as the editor holds :id, a Parameters strip opens between the editor and the results with one input for it. Type 42, press Run (Cmd+Enter / Ctrl+Enter), and SQLly sends WHERE id = 42. It works the same on every database SQLly connects to.

SQLly
A MariaDB query with WHERE id = :id, the Parameters strip holding 42, and the matching row in the results.A MariaDB query with WHERE id = :id, the Parameters strip holding 42, and the matching row in the results.
A MariaDB query with WHERE id = :id, the Parameters strip holding 42, and the matching row in the results.

Placeholder styles

:name
A named placeholder, on every engine. Use the same name twice and it is one input: WHERE a.client_id = :client_id OR b.client_id = :client_id. Names are not case-sensitive, so :ID and :id share a value.
?
A positional placeholder, on every engine except PostgreSQL (where ? is a JSON operator). The strip lists them as ?1, ?2… in the order they appear in the script, and keeps that numbering when you run just one statement. SQLite's numbered form, ?3, keeps its own number.
$1
PostgreSQL and DuckDB's numbered placeholder. $1 used twice is one input.
@name
SQL Server's own parameter style. An @name the script never declares, such as WHERE CustomerID = @CustomerId, gets an input like any other placeholder. Variables the script binds itself are left alone: anything in a DECLARE list (table variables too), the target of SET @x, SELECT @x = or FETCH … INTO @x, the parameter names in EXEC dbo.Proc @Id = …, @@ROWCOUNT-style functions, and every name in a script that creates a procedure, function or trigger (Procedure mode fills those). On MySQL @name is a user variable and never asks for a value.
SQLly
Two named placeholders, :client_id and :status, filled in the Parameters strip with the filtered beneficiaries below.Two named placeholders, :client_id and :status, filled in the Parameters strip with the filtered beneficiaries below.
Two named placeholders, :client_id and :status, filled in the Parameters strip with the filtered beneficiaries below.
SQLly
A SQL Server script that DECLAREs @top and filters on an undeclared @Country: only @Country has an input in the Parameters strip, filled with France.A SQL Server script that DECLAREs @top and filters on an undeclared @Country: only @Country has an input in the Parameters strip, filled with France.
A SQL Server script that DECLAREs @top and filters on an undeclared @Country: only @Country has an input in the Parameters strip, filled with France.

How a value is sent

Values are turned into a literal your database understands and escaped for it, so a quote, a backslash or a ' OR '1'='1 in a value is only ever data. What you type decides the kind of value:

Numbers
42, -3.5 and 1e6 go in as numbers. A number with a leading zero, like a postcode 007, stays text.
true / false
Booleans, written the way your engine spells them (1/0 on SQL Server and MySQL).
NULL
SQL NULL. An empty input is never NULL: it is missing, and Run asks for it.
Anything else
Text, quoted for your engine: active becomes 'active'.
'quoted'
Wrap a value in single quotes to force text: '42' sends the string 42, and '' sends an empty string.
PostgreSQL. Every value except NULL is sent as an untyped literal, which PostgreSQL reads as whatever type the comparison needs, so int_col = :id and text_col = :id both work with the same input.

Only the statement you run needs values

The strip lists every placeholder in the script, so you can fill values in ahead of time. When you run, only the placeholders in what is actually running (the selection, or the current statement) need a value. If one is empty, nothing is sent: the status bar names it, its row says required, and the cursor jumps into it.

SQLly
Two positional ? placeholders: the first holds a date, the second is empty and marked required after Run was blocked.Two positional ? placeholders: the first holds a date, the second is empty and marked required after Run was blocked.
Two positional ? placeholders: the first holds a date, the second is empty and marked required after Run was blocked.

Explain and the query plan commands use the same values, so a plan is for the query you will really run.

Give a placeholder a type and a default

A -- sqlly param: line types a placeholder: the input is checked before Run, and an empty input falls back to the default.

-- sqlly param: :since date = 2026-01-01
-- sqlly param: :limit int = 50
SELECT * FROM orders WHERE created_at >= :since LIMIT :limit;

Types are text, int, decimal, bool, date, datetime, time, uuid, json and binary. The same line with an @name declares a parameter that SQLly substitutes for @name itself; see SQLly directives.

What is never a placeholder

SQLly reads your SQL the way your database does, so it does not ask for values that are not parameters: anything inside a string, a comment, a quoted name or a PostgreSQL $$ function body; :: casts; array slices such as arr[lo:hi]; JSON paths such as metadata:country; MySQL's := and loop labels; SQL Server sqlcmd lines such as :setvar; and Oracle's :new / :old in triggers.

Values stay with the tab

Typed values are saved with the tab, travel with it to another window, and come back when SQLly starts again. For named placeholders, recently used values appear as one-click chips beside the input, and the formatter leaves placeholders exactly as written.

Turning it off. If you never want placeholders to ask for values, clear Settings › Editor › General › Query parameters › Ask for values of :name, ? and $1 placeholders. -- sqlly param: lines keep working.