// DuckDB error reference

Binder Error: The column is not in the FROM clause

The query names a column that no table or alias in its FROM clause provides, so DuckDB cannot bind it.

Exception
Binder Error
Catégorie
Binder Error
Message d'erreur
Binder Error: Referenced column "nope" not found in FROM clause!

Ce que cela signifie

The binder resolved the FROM clause first, then looked up every column reference in it. The name in quotes is the one it could not find anywhere in that scope. DuckDB will not guess: a missing column is an error even when another table in the database has it.

Typical traps are the wrong alias (or no alias where a subquery needs one), a CTE referenced by a column it does not select, and a USING/JOIN that narrowed which columns remain visible. In INSERT or UPDATE the same class appears when the target table lacks a column you name.

Causes courantes

  • A misspelled column name. Matching ignores case, quoted or not, so a wrong case alone does not cause this error.
  • The column belongs to a table that is not in the FROM clause, or a missing join to reach it.
  • A subquery or CTE that does not project the column, so the outer query cannot see it.
  • A GROUP BY or window context where the column is neither grouped nor aggregated, which DuckDB reports as a binder problem about the column.

Find the cause

-- What does the query actually have to work with?
DESCRIBE my_table;
-- Every column named email anywhere in the catalog:
SELECT table_schema, table_name, column_name FROM information_schema.columns WHERE column_name ILIKE '%email%';
-- Which tables are in the statement's scope:
SELECT * FROM duckdb_tables() WHERE table_name IN ('orders','customers');

Comment le corriger

  1. Check the real columns of the table you query, not the ones you remember:

    DESCRIBE my_table;
    SELECT column_name, data_type FROM information_schema.columns WHERE table_name = 'my_table' ORDER BY ordinal_position;
  2. When the name may exist in several tables, find which one has it:

    SELECT table_schema, table_name FROM information_schema.columns WHERE column_name = 'email' ORDER BY 1, 2;
  3. Qualify ambiguous references with the table or alias so the binder knows which one you mean:

    SELECT o.id, c.name FROM orders o JOIN customers c ON o.customer_id = c.id;
  4. Project a column in a CTE if the outer query needs it:

    WITH recent AS (SELECT id, email FROM users WHERE created_at > now() - INTERVAL 7 DAY)
    SELECT email FROM recent;

Other ways to handle it

If the column is genuinely missing, add it with ALTER TABLE ... ADD COLUMN rather than changing the query. If the name is ambiguous across joins, always qualify references; unqualified names fail with an ambiguous-reference Binder Error (for example: Ambiguous reference to column name "id" (use: 'o.id' or 'c.id')) when a new column with the same name appears in the other table.

Reproduisez-le en toute sécurité

SELECT nope FROM range(3);   -- Binder Error: Referenced column "nope" not found in FROM clause!

Questions

The column exists. Why is it not found?

Check the scope, not just the database. Inside a join, subquery or CTE, only the columns the clause projects are visible, and an alias may hide the table that has the column.

Does quoting change how a column name is matched?

No. DuckDB matches column names case-insensitively whether or not they are quoted, so a column created as "Email" is found by email, "EMAIL" or "Email".

Erreurs liées

Le code et le texte du message sont issus de DuckDB documentation. Parcourir la liste complète DuckDB error list ou Rechercher toutes les erreurs de base de données.

// moins d'erreurs, corrections plus rapides

Work on DuckDB in SQLly

A native SQL client for macOS, Windows and Linux with schema-aware IntelliSense, guardrails for risky statements and clear error messages, for DuckDB and the other databases you use.

Texte et données de cette page : CC BY 4.0, en citant SQLly (sqlly.app). Code et extraits SQL : MIT. Détails de la licence Le texte des messages d’erreur cité appartient à l’éditeur de la base de données.