# invalid reference to FROM-clause entry for table "customers"

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


**Short answer:** Once a table has an alias in FROM, the query must use the alias: after `FROM customers c`, write `c.name`, not `customers.name`. The table's own name is hidden by the alias.

## The exact messages

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

## How PostgreSQL prints it

```
ERROR:  invalid reference to FROM-clause entry for table "customers"
LINE 1: SELECT customers.name, o.ordered_on
               ^
HINT:  Perhaps you meant to reference the table alias "c".
```

## Why it happens

### Mixing the table name and its alias

Common after adding aliases to a query that used full table names. Replace every `customers.` with `c.`.

### A copied column list

Columns pasted from another query that used a different alias. PostgreSQL's hint names the alias it expected.

## The broken query

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

## The fix

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

`c` is the only name `customers` has in this query.

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