SQL IN List Builder

← All tools

One value per line becomes an IN list. A single quote inside a value is written twice, which is how standard SQL escapes it.

The values never leave the browser. Nothing is uploaded, and the list is not stored in the URL.

A comma stays inside the value. The column, the quoting mode, and the blank-line switch are the only things stored in the URL.

No list

IN list

Copy uses the SQL line, without the value count.

About this tool

An IN list is a list of literals. IN () is a syntax error, so an empty paste is refused. A quote in a value is doubled: O'Brienbecomes 'O''Brien'. That is the SQL string rule, not a backslash escape.

Auto mode leaves a plain integer or decimal unquoted, and it leaves NULLunquoted so it is the SQL null. A token such as 007 stays quoted, because unquoted it is the number 7. A backslash is copied through. Postgres, withstandard_conforming_strings on, does the same.

This builds a literal list for a query you are writing by hand. If the values come from a user, use a parameter. The SQL injection post shows why string pasting is the wrong place for untrusted input. For a wholeINSERT, use the CSV to SQL converter.

Read more

Free books, courses, and software

Get my programming books, course editions, and complete software.

Get the download library →