1054ERRORTier 1 — Safe✅ HIGH confidenceUnknown column in field list
What this means
Error 1054 (SQLSTATE 42S22) is returned when a query references a column name that does not exist in the specified table or is ambiguous in the FROM clause. This is a compile-time error — the query is rejected before execution.
Why it happens
- 1Column name typo in SELECT, WHERE, or ORDER BY
- 2Referencing a column that was renamed in a schema migration
- 3Using a column alias in a WHERE clause (not allowed — aliases are resolved after WHERE)
- 4Ambiguous column name when the same column name exists in multiple joined tables
How to reproduce
A SELECT references a column that does not exist.
CREATE TABLE users (id INT, email VARCHAR(255));
SELECT user_name FROM users; -- column is 'email', not 'user_name'Fix 1: Check the actual column names with DESCRIBE
When unsure of the exact column names.
DESCRIBE users;
-- or:
SHOW COLUMNS FROM users;Why this works
DESCRIBE returns the column name, type, nullability, key, default value, and extra attributes for each column in the table, giving the exact names to use in queries.
Fix 2: Qualify ambiguous column names with the table name
When the same column name exists in multiple joined tables.
SELECT users.id, orders.id AS order_id
FROM users
JOIN orders ON users.id = orders.user_id;Why this works
Using table.column notation eliminates ambiguity. The parser can then resolve each column reference to its specific table.
What not to do
Use SELECT * to avoid specifying column names
Why it's wrong: While SELECT * avoids 1054, it returns all columns including ones the application does not need, and will silently change shape if columns are added or removed.
Version notes
All versionsStable error code.Sources
📚 Official docs: https://mariadb.com/kb/en/describe/
🔧 Source ref: MariaDB Server error code 1054 / ER_BAD_FIELD_ERROR
📖 Further reading: MariaDB DESCRIBE
Confidence assessment
✅ HIGH confidence
Stable.
See also
🔗 Related errors
📄 Reference pages