sqlstreak

SQL error

missing FROM-clause entry for table "customers"

Updated · Tested on PostgreSQL 18.6 and SQLite 3.54.1 (results generated , re-checked on every release)

Short answer

You referenced a table (or alias) that isn't in your FROM or JOIN clauses. Join that table, or use the alias you actually defined.

The exact messages

  • PostgreSQLERROR: missing FROM-clause entry for table "customers"
  • SQLiteno such column: customers.name

How to read this message

This is what PostgreSQL 18.6 prints for the broken query below, the way psql shows it. LINE gives the line it was reading when it gave up, and the ^ marks the exact spot.

ERROR:  missing FROM-clause entry for table "customers"
LINE 1: SELECT customers.name, ordered_on
               ^

SQLite 3.54.1 reports the same mistake as no such column: customers.name, with no line number: look for the word or column it names.

Why it happens

Forgetting the JOIN

Selecting customers.name from orders alone doesn't bring in the customers table.

Using the full name after defining an alias

After FROM customers c, PostgreSQL expects c.name, not customers.name.

Reproduce it, then fix it

Both queries run on a real database in your browser. Switch dialects to compare.

Broken
SELECT customers.name, ordered_on
FROM orders;
Fixed
SELECT c.name, o.ordered_on
FROM orders o
JOIN customers c ON c.id = o.customer_id;

Join the table you need and refer to it by its alias.

The fix returns, PostgreSQL: first 6 of 17 rows

nameordered_on
Maya Ortiz2026-03-01
Jonah Reed2026-03-01
Maya Ortiz2026-03-03
Priya Nair2026-03-04
Tomás Herrera2026-03-05
Ellie Park2026-03-05

The fix returns, SQLite: first 6 of 17 rows

nameordered_on
Maya Ortiz2026-03-01
Jonah Reed2026-03-01
Maya Ortiz2026-03-03
Priya Nair2026-03-04
Tomás Herrera2026-03-05
Ellie Park2026-03-05

Experiment with it: PostgreSQL playground·SQLite playground

Official documentation

Stop hitting this error

Practise the concept behind it in a five-minute lesson, or read the full guide: SQL JOINs explained.