on this tutorial, we’ll discover ways to repair “UNKNOWN COLUMN IN ‘FIELD LIST’”. Generally, We’re are getting errors after every insert or replace to the MySQL desk.
The message is “Unknown column ‘column-name’ in ‘discipline record’” whereas this column was current on this desk.
The most typical causes of the error “MySQL: Unknown column in discipline record” are listed on this tutorial.
unknown column in discipline record error?
The MySQL unknown column in discipline record error occurs while you put a column identify in your SQL script that may’t be discovered by MySQL.
I’ve created an
worker desk and inserted information as beneath:
The next error message is thrown by MySQL while you try and insert information right into a column that doesn’t exist within the desk:
Choice 1: The column identify shouldn’t be discovered
Let’s create a SQL to insert information into the non-existence column:
INSERT INTO workers(emp_name) VALUES ('Tim');
The error beneath is as a result of there’s no
emp_name column within the workers desk.
Choice 2: Column worth shouldn’t be wrapped with Quotes
Generally, We didn’t use quotes for the string values and in addition throw the identical errors.
INSERT INTO workers(emp_name) VALUES (Tim);
-- ERROR 1054 (42S22): Unknown column 'Tim' in 'discipline record'
The worth Tim have to be wrapped in quotations (” or “”). Your try and put values into the goal column from a unique column can be misinterpreted by MySQL.
Choice 3: calling a variable with out the @ image
The identical error will throw if calling a variable with out the
SET @identify="Tim"; SELECT identify;
The Error message:
-- ERROR 1054 (42S22): Unknown column 'identify' in 'discipline record'
Choice 4: MySQL Set off problem
Generally, we’ve got outlined triggers into MySQL which have columns that don’t exist, t ll set off when any file insert into MySQL.
create set off insert_on_emp after insert on worker for every row start insert into division (identify, dept) values (new.identify, 'devops'); finish## delimiter ;
To resolve the error I’ll want both rewrite the set off and take away
dept column from the insert command or alter desk ‘division’ and add column ‘dept’.