Skip to content
OddsockLocal
Local
Source text

The preview shows up here.

ReadyRuns in this browser. Nothing is uploaded.

How to use

  1. Paste a JSON array, or a comma- or newline-separated list.
  2. Use JSON when a value contains a comma.
  3. Copy the IN (...) fragment, including the parentheses.
  4. Put your column name in front of it in the query.

What is SQL IN clause?

An IN list is easy until a value contains a comma. Paste ["A,B", 2, null] and the page returns IN ('A,B', 2, NULL). The comma between A and B stays inside the quotes. The number 2 is not quoted. null becomes the keyword NULL, not the string 'null'.

Read more

You can also type a loose list separated by commas or newlines, and each piece is typed: a number stays a number, true and false become booleans, and other tokens become strings. The JSON form is the one to use when a value itself contains a comma, because a split on commas would have turned A,B into two values.

The result is only the IN (...) fragment. It does not name a column and it does not write WHERE. You paste it after the column yourself. Empty input is an error.

Use cases

  • A filter should include the product code A,B as one value, not as A and B.
  • A mix of ids and a SQL NULL has to be 2, NULL rather than '2', 'null'.
  • You have a JSON array from a query builder and you want the fragment without writing the quotes.
  • A newline-separated list of names should become one IN list for a query you are pasting into a console.

A comma inside a value, a number and a null

["A,B", 2, null]

IN ('A,B', 2, NULL)

Why use Oddsock

JSON is how a comma survives. A plain split would have made IN ('A', 'B', ...) and changed the filter.

Related tools

Using this tool

It was a JSON string. The comma is inside the quotes in the SQL. A loose list split on commas would have separated A and B.