Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

sql error: Unknown column in 'field list' on insert [duplicate]

I am trying to insert an entry into a table, using Java, and it returns me an error "Unknown column XX in 'field list'".

For example: I have created a table using this line:

CREATE  TABLE `dbcs`.`born in` (`person` VARCHAR(100) ,`year` INT ,`prob` FLOAT);

the table was created successfully.

when I try to insert something to the table, it shows me the error. for example, the command:

INSERT INTO `dbcs`.`born in` VALUES (`Alanis Morissette`,1974,1.0)

will generate the error:

Unknown column 'Alanis Morissette' in 'field list'

like image 585
Pasha Avatar asked Feb 11 '13 17:02

Pasha


2 Answers

Strings must be wrapped in quotes. You're using ticks which are not correct.

INSERT INTO `dbcs`.`born in` VALUES ('Alanis Morissette',1974,1.0)
like image 142
John Conde Avatar answered Oct 22 '22 23:10

John Conde


use

INSERT INTO dbcs.born in VALUES ('Alanis Morissette',1974,1.0)
like image 44
Akash Avatar answered Oct 22 '22 23:10

Akash