Readable SQL with clauses, joins and subqueries laid out
SQL IN Clause Generator
Go from a column copied out of a spreadsheet to a WHERE id IN (...) clause without fixing quotes by hand.
Loading tool…
How to use sql in clause generator
Paste values one per line or separated by commas or tabs.
Enter the column name, or leave it empty for just the list.
Choose quoting, duplicate removal and NOT IN.
Set values per list if your database has a limit, then copy the clause.
What this tool does
- Quotes automatically: numbers stay bare unless a value is not a number.
- Removes duplicates and empty lines and trims spaces, reporting how many were dropped.
- Splits long lists into several IN lists joined with OR (or AND for NOT IN).
- Escapes single quotes for every database and backslashes for MySQL.
How the result is verified
The generated clause is tokenised and every value is decoded back and compared with your cleaned list.
Frequently asked questions
Why keep 007 in quotes?
A value with a leading zero is treated as text so the zeros survive. Choose 'Never' quoting if the column really is numeric.
Is there a limit to IN list length?
Oracle allows 1,000 expressions per list, which is the default chunk size here. PostgreSQL and MySQL accept more, but large lists are slow to parse.
Is my data uploaded to a server?
No. Everything you drop, paste or type is processed by code running in this browser tab. You can check it yourself: open your browser's developer tools, watch the Network panel, and use the tool. No request carries your data.
Related tools
Batched INSERT statements from pasted CSV or JSON
CSV to INSERT statements with CREATE TABLE for four databases
SQL on one line, with comments removed or kept