# missing FROM-clause entry for table "customers"

Source: https://sqlstreak.com/sql/errors/missing-from-clause-entry · Tested on PostgreSQL 18.6 and SQLite 3.54.1; results generated 2026-11-22.


**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

- PostgreSQL: `ERROR: missing FROM-clause entry for table "customers"`
- SQLite: `no such column: customers.name`

## How PostgreSQL prints it

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

## 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`.

## The broken query

```sql
SELECT customers.name, ordered_on
FROM orders;
```

## The fix

```sql
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.

| name | ordered_on |
| --- | --- |
| Maya Ortiz | 2026-03-01 |
| Jonah Reed | 2026-03-01 |
| Maya Ortiz | 2026-03-03 |
| Priya Nair | 2026-03-04 |
| Tomás Herrera | 2026-03-05 |
| Ellie Park | 2026-03-05 |

(6 of 17 rows)
