sqlstreak

SQL error

column "x" does not exist / no such column: x

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

Short answer

The database can't find a column with that name in the tables listed in FROM. Check the spelling against the table, join the table the column really lives in, and keep text in single quotes: double quotes mean a column name.

The exact messages

  • PostgreSQLERROR: column "nme" does not exist
  • SQLiteno such column: nme

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. HINT is PostgreSQL's own suggestion, and it's usually worth following.

ERROR:  column "nme" does not exist
LINE 1: SELECT nme, city
               ^
HINT:  Perhaps you meant to reference the column "customers.name".

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

Why it happens

A typo in the column name

nme instead of name. PostgreSQL often adds a hint such as “Perhaps you meant to reference the column…”; read it, it's usually right.

The column belongs to another table

Asking for ordered_on while selecting only from customers. Join orders first; a column is only visible when its table is in FROM or a JOIN.

Text in double quotes

WHERE city = "Austin" asks for a column called Austin. See the page on double quotes for the full story.

An alias from SELECT used in WHERE

WHERE total > 10 when total is an alias created in SELECT. WHERE runs before SELECT, so the alias doesn't exist yet.

Reproduce it, then fix it

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

Broken
SELECT nme, city
FROM customers;
Fixed
SELECT name, city
FROM customers;

Use the column's exact name. Run SELECT * FROM customers LIMIT 1; to see every column of a table.

The fix returns, PostgreSQL: first 6 of 10 rows

namecity
Maya OrtizAustin
Jonah ReedDenver
Priya NairAustin
Tomás HerreraBoston
Ellie ParkDenver
Sam OkaforBoston

The fix returns, SQLite: first 6 of 10 rows

namecity
Maya OrtizAustin
Jonah ReedDenver
Priya NairAustin
Tomás HerreraBoston
Ellie ParkDenver
Sam OkaforBoston

Experiment with it: PostgreSQL playground·SQLite playground

Another fix

When the column lives in another table, join that table and name the column through its alias.

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

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

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

Official documentation

Stop hitting this error

Practise the concept behind it in a five-minute lesson, or read the full guide: The SQL SELECT statement.