How to Use This Tool
Paste a column from a spreadsheet or a query result. You get a working IN clause with
the awkward parts handled.
NOT IN with a NULL matches nothing
This is the one worth knowing. x NOT IN (1, 2, NULL) returns zero rows,
always, and raises no error.
The reason is three-valued logic. NOT IN expands to
x <> 1 AND x <> 2 AND x <> NULL. That last comparison is never true and
never false — it is unknown — and an AND containing unknown can never
be true. So the whole condition fails for every row.
IN is safe by comparison: the NULL is simply never matched, and the other values work
normally. But a single stray NULL in a NOT IN list silently empties your result set, which
is why this tool pulls NULLs out and writes OR x IS NULL explicitly instead.
Apostrophes are escaped by doubling
A value like O'Brien ends the string early and breaks the query. The SQL standard escape
is to double the apostrophe: 'O''Brien'.
Backslash escaping ('O\'Brien') is a MySQL extension, not standard, and it is off by
default in some configurations. Doubling works everywhere, so that is what this produces.
That said — and this matters more than the escaping — if these values come from user input, use parameters instead of building a string. This tool is for pasting a list you already have, not for assembling queries at runtime.
Length limits
Oracle rejects an IN list of more than 1000 items with ORA-01795.
SQL Server and PostgreSQL have no hard limit but slow down badly on very long lists — the planner
treats each value separately. Past a few thousand, load the values into a temporary table and join
instead. The tool warns when you cross 1000.
