SQL IN Clause Builder / Chunker
Paste a list of IDs or values — one per line, comma/tab-separated, a JSON array, or an existing IN(...) fragment — and build a quoted, de-duplicated, chunked SQL IN clause. Quoting and chunk limits follow the dialect you pick, so Postgres gets "identifiers" where MySQL gets backticks and Oracle stays under its 1000-item ceiling. Runs in your browser.
Auto-builds as you type. Ctrl+Enter to re-run.
How to use the SQL IN Clause Builder & Chunker
Paste a list of IDs, emails, SKUs, UUIDs, or any values — from Excel, a CSV column, a ticket, a log, or a JSON array — and generate a properly quoted IN (...) or NOT IN (...) clause ready to drop into your SQL query. Auto-quotes strings, escapes safely, deduplicates, and chunks long lists past database limits (Oracle 1000, SQL Server 2100 parameters, etc.) into OR-joined groups. Runs locally; values never leave your browser.
What it does
- Builds
IN (...)andNOT IN (...)clauses from a list. - Auto-detects the input format: one-per-line, comma-separated, tab-separated, JSON array, or an existing IN fragment.
- Quotes strings with SQL-safe single quotes; escapes embedded quotes (
O''Brien). - Leaves numeric IDs unquoted by default for index-friendly queries.
- Deduplicates and optionally sorts the list.
- Chunks large lists into safe groups joined with
ORfor Oracle, SQL Server, and other databases with IN-clause limits. - Also exports the values as a JS / Python / JSON array or CSV, and shows a VALUES / JOIN alternative for the chosen dialect.
When to use it
- A stakeholder emails a list of customer IDs and you need to query them now.
- You exported a column from a spreadsheet and need to look those rows up.
- You want to
UPDATEorDELETEa specific set of records by ID. - Your database rejects a single long IN clause and you need it split.
- You need to filter logs or analytics by a known set of tenant or user IDs.
- You are building a one-off backfill / cleanup query for a known cohort.
How to use it
- Paste your list — one value per line, comma-separated, tab-separated, or a JSON array.
- Set the Quoting mode for VARCHAR / TEXT columns; leave numbers unquoted with Auto.
- Toggle De-duplicate to remove repeats and reduce query load.
- Set a chunk size if the target database limits IN-clause length (Oracle 1000, SQL Server 2100 parameters).
- Copy the generated clause into your query:
WHERE id IN (...)orWHERE email NOT IN (...). - For composite lookups, hand off to the SQL Join Builder; clean lists first with the List Comparator.
Tips & pitfalls
- Oracle limits IN to 1000 items. Use chunking or rewrite as a join against an inline values table (see the Advice tab).
- SQL Server caps parameters at 2100 when using parameterized queries. Inline literals avoid this but lose plan caching.
- Beware SQL injection if values come from untrusted input — prefer parameterized queries in production code.
- For very large lists (10k+ items), a temporary table or values clause is faster than IN with many literals.
- Mixed type lists usually mean a data quality issue — clean with the List Comparator first.
- Empty list ⇒ empty clause; the builder warns rather than emitting invalid SQL.
FAQ
- How do I build a SQL IN clause from a list? Paste the list, set the quoting mode as needed, and copy the generated
IN (...)clause into your query. - How do I handle Oracle's 1000-item limit? Set a chunk size; the builder emits multiple IN clauses joined with
OR. The Advice tab also shows a VALUES/JOIN rewrite. - Should I quote numeric IDs? Usually no — keep them unquoted (the Auto quoting mode) so the database can use the column's index without implicit conversion.
- Is my list uploaded? No. Generation runs entirely in your browser.
- What is the difference between IN and NOT IN with NULLs?
NOT INwith any NULL in the list returns no rows. UseNOT EXISTSor filter NULLs first. - Can I use this for parameterized queries? Yes. The Advice tab generates the parameterized form directly: placeholders in your dialect's syntax (
$1, $2for PostgreSQL,:1for Oracle,@p1for SQL Server,?elsewhere) plus the matching values array. Nothing is inlined into the SQL, so quotes and other characters need no escaping — this is the injection-safe form and the one to prefer.
Runs locally in your browser. No uploads. Always parameterize untrusted values in production code to prevent SQL injection.
Related guides
Common tasks solved by this tool
- Generate a SQL IN clause from copied values
- Turn a CSV column into an IN list
- Prepare IDs from a compared list
- Clean and dedupe values first
- Build filters for missing-row queries
Continue in a data cleanup workflow
Chain this into related tools, or build it as a saved workflow in Workflows.
- Compare two CSV exports
- Extract missing or changed rows
- Clean and dedupe the values
- Build a SQL IN clause from the result — this tool
Part of the data cleanup and QA toolkit
Compare exports, find missing rows, clean lists and prepare SQL filters for QA and migration checks.