TOOLTIKI Lovable tool, really free
Developer Data

SQL IN list formatter

What to do

Processed in your browser · nothing is uploaded

Local · quoted only when it must be
Advertisement
320 × 100

Turns a pasted column of values into a SQL `IN (…)` list, quoting them only if they are not all numbers, and optionally wrapping the whole thing in `column IN (…)`.

How to use the sql in list formatter

1 Paste your input. The result appears immediately.
2 Pick the operation you want.
3 Copy the result, or save it as a file.

This is the most common five-second task in a database console: someone sends a list of IDs in a message and you need them in a query. Doing it by hand means adding a comma to every line and quotes to some of them, which is exactly the sort of task that produces a syntax error on the third attempt. Quoting is decided by looking at the values: if every one is a number the list is left bare, so an integer column matches; if any is not, all are quoted. That is safer than mixing, because a quoted number still matches an integer column in most databases while an unquoted string is a syntax error. One limit worth knowing before you paste ten thousand rows: Oracle refuses more than 1,000 items in an IN list outright, and SQL Server and PostgreSQL will accept far more but plan the query badly. Past a few hundred values, loading them into a temporary table and joining is both faster and legal everywhere.

Questions

If every value is a number, none are. If any is not, all are — mixing is what causes syntax errors.

PostgreSQL — IN expressions
Advertisement
300 × 250
Was this tool any good?
INTERNAL SIGNAL ONLY · WE USE IT TO FIND TOOLS WORTH REBUILDING