Top 10 SQL Errors
How to Fix MySQL "Unknown column"
MySQL cannot find the column in the table or query scope.
Example error message
ERROR 1054 (42S22): Unknown column 'username' in 'field list'
Common causes
- The column name is misspelled.
- The column does not exist in that table.
- You used an alias in the wrong part of the query.
- The query needs a JOIN.
Quick fix
SELECT name FROM users;
Checklist
- Check spelling of table and column names.
- Check the correct database, schema, and table alias.
- Compare your SQL dialect: MySQL, PostgreSQL, SQL Server, Oracle, or SQLite.
- Run a very small SELECT query first, then add conditions step by step.