
- Learn MySQL
- MySQL - Home
- MySQL - Introduction
- MySQL - Installation
- MySQL - Administration
- MySQL - PHP Syntax
- MySQL - Connection
- MySQL - Create Database
- MySQL - Drop Database
- MySQL - Select Database
- MySQL - Data Types
- MySQL - Create Tables
- MySQL - Drop Tables
- MySQL - Insert Query
- MySQL - Select Query
- MySQL - Where Clause
- MySQL - Update Query
- MySQL - Delete Query
- MySQL - Like Clause
- MySQL - Sorting Results
- MySQL - Using Join
- MySQL - NULL Values
- MySQL - Regexps
- MySQL - Transactions
- MySQL - Alter Command
- MySQL - Indexes
- MySQL - Temporary Tables
- MySQL - Clone Tables
- MySQL - Database Info
- MySQL - Using Sequences
- MySQL - Handling Duplicates
- MySQL - SQL Injection
- MySQL - Database Export
- MySQL - Database Import
Why the #1054 - Unknown column error occurs in MySQL and how to fix it?
Let’s see when the #1054 error occurs in MySQL. While inserting a varchar value, if you will forget to add single quotes, then this error will arise.
Following is the error −
mysql> insert into DemoTable798 values(100,Adam); ERROR 1054 (42S22): Unknown column 'Adam' in 'field list'
You need to use single quotes around the string value to fix this error as shown below −
mysql> insert into DemoTable798 values(100,’Adam’);
Let us first create a table −
mysql> create table DemoTable798 ( StudentId int, StudentName varchar(100) ); Query OK, 0 rows affected (0.51 sec)
Insert some records in the table using insert command −
mysql> insert into DemoTable798 values(100,'Adam'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable798 values(101,'Chris'); Query OK, 1 row affected (0.19 sec) mysql> insert into DemoTable798 values(102,'Robert'); Query OK, 1 row affected (0.16 sec) mysql> insert into DemoTable798 values(103,'Carol'); Query OK, 1 row affected (0.16 sec)
Display all records from the table using select statement −
mysql> select *from DemoTable798;
This will produce the following output -
+-----------+-------------+ | StudentId | StudentName | +-----------+-------------+ | 100 | Adam | | 101 | Chris | | 102 | Robert | | 103 | Carol | +-----------+-------------+ 4 rows in set (0.00 sec)
- Related Articles
- Fix Drop table view #1051 unknown table error in MySQL
- Fix MySQL Database Error #1064?
- Fix for MySQL ERROR 1406: Data too long for column” but it shouldn't be?
- Why the error Collection was modified; enumeration operation may not execute occurs and how to handle it in C#?
- Fix Error in MySQL syntax while creating a table column with name “index”?
- How to resolve the error that occurs while using a reserved word as a table or column name in MySQL?
- Resolve Unknown database in JDBC error with Java-MySQL?\n
- Fix MySQL ERROR 1075 (42000): Incorrect table definition; there can be only one auto column and it must be defined as a key
- Fix ERROR 1064 (42000) while creating a database in MySQL?
- Fix Error with TYPE=HEAP for temporary tables in MySQL?
- Fix error in MySQL “select ClientId,ClientName,ClientAge, from tablename”
- Fix: ERROR 1396 (HY000): Operation CREATE USER failed in MySQL?
- How to fix problems related to the JavaScript Void 0 Error?
- Why Your Computer is Running Slow and How You Can Fix It?
- Fix MySQL Error #1064 - You have an error in your SQL syntax… near 'TYPE=MyISAM?

Advertisements