Cette page n’est pas encore traduite en français : elle s’affiche en anglais.

SQL IN Clause Generator

Paste IDs, emails or codes — one per line, comma-separated or straight from an Excel column — and get a ready-made WHERE … IN (…) clause.

Mis à jour le
Split on
Output
Quoting
Clean-up
Layout

Groups: 0 = no limit; use 1000 for Oracle.

Vos données ne quittent jamais votre ordinateur. Tout le traitement se fait localement dans votre navigateur.

Comment utiliser : SQL IN Clause Generator

  1. Paste your values — copy a column from Excel or Google Sheets, or paste a comma-separated list.
  2. Choose the output form, column name and table, and whether to use NOT IN.
  3. Quoting is automatic: numbers stay unquoted, text is wrapped in single quotes with apostrophes escaped.
  4. Copy the SQL into your query. Use groups of 1,000 for Oracle.

What is a SQL IN clause?

The IN operator tests whether a value matches any item in a list. It is shorthand for a chain of OR conditions and is the usual way to look up a batch of records you already have IDs for — for example a column of order numbers someone sent you in a spreadsheet:

SELECT *
FROM orders
WHERE id IN ('A-1001', 'A-1002', 'B-2040');

Typing the quotes and commas by hand for hundreds of values is tedious and easy to get wrong. This generator does it in one paste.

Quoting and escaping

InputAuto quoting
1001, 1002 (all numbers)(1001, 1002)
A-1001, B-2040('A-1001', 'B-2040')
O'Neil'O''Neil' — the apostrophe is doubled
Unicode text in SQL ServerN'Zoë' with the N prefix option

Use Always when a numeric-looking column is stored as text (for example ZIP codes or phone numbers), so the database does not have to convert types and can use its index.

Limits per database

  • Oracle allows at most 1,000 expressions in one IN list (error ORA-01795). Set groups of 1,000 and the generator joins them with OR.
  • SQL Server has no fixed limit, but statements with many thousands of values parse slowly; use a temporary table or table-valued parameter instead.
  • MySQL is limited by max_allowed_packet; PostgreSQL can also take an array: WHERE id = ANY('{1,2,3}').

Safety note

Pasting generated lists is fine for ad-hoc queries in a database client. In application code, never build SQL by concatenating user input — use parameterized queries. Format long queries with the SQL Formatter, and remove duplicate lines from other lists with Remove Duplicate Lines.

Aussi recherché comme : sql in list generator, where in clause, list to sql in, excel column to sql in, comma separated list to sql, in clause builder, sql values list.

Outils complémentaires : SQL IN Clause Generator

  • CREATE TABLE Generator — Design a table column by column — types, primary key, NOT NULL, UNIQUE, auto-increment and defaults — and get the correct CREATE TABLE syntax for your database.
  • CSV & Excel to SQL — Paste CSV or Excel cells, or open an .xlsx file, and get ready-to-run CREATE TABLE and INSERT statements with correctly escaped values for your database.
  • SQL to JSON, CSV & Excel — Paste a SQL dump or a few INSERT statements and get the rows back as JSON, CSV or an Excel workbook with one sheet per table.
  • Excel to JSON — Open an .xlsx workbook or paste cells straight from Excel or Google Sheets and get clean JSON.

Questions fréquentes

How do I turn an Excel column into a SQL IN list?
Select the cells in the column, copy, and paste them into the Values pane. Each cell becomes one value, duplicates are removed and text is quoted automatically.
What is the maximum number of values in an IN clause?
Oracle allows 1,000 per list. Other databases have no hard limit but get slow with very long lists — use a temporary table or a join for tens of thousands of values.
Should numbers be quoted?
Not if the column is numeric. If the column is text (such as codes with leading zeros), quote them so the database compares strings and can use its index.
How do I find rows that are not in the list?
Tick NOT IN. Be careful: if the list contains NULL, NOT IN returns no rows in standard SQL.
Puis-je installer SQL IN Clause Generator en tant qu’application web et l’utiliser hors ligne ?
Oui. SQL IN Clause Generator est une application web installable (PWA) : elle s’installe depuis votre navigateur, sans passer par une boutique d’applications. Cliquez sur « Installer l’application » en haut de cette page dans Chrome ou Edge (Windows, macOS, Linux, ChromeOS) ; sur Android, utilisez « Partager » → « Ajouter à l’écran d’accueil » sur iPhone et iPad ; ou « Fichier » → « Ajouter au Dock » dans Safari 17+ sur Mac. L’application s’ouvre alors dans sa propre fenêtre avec sa propre icône, et comme elle s’exécute entièrement dans votre navigateur, elle continue de fonctionner hors ligne. Firefox sur ordinateur de bureau ne permet pas d’installer d’applications web. Comment fonctionne l’installation.

Outils similaires