11

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'

John Conde
  • 212,985
  • 98
  • 444
  • 485
Pasha
  • 165
  • 1
  • 1
  • 9
  • Delimit String values with quotes i.e. INSERT INTO dbcs.born in VALUES ('Alanis Morissette',1974,1.0) – myqyl4 Feb 11 '13 at 17:29

2 Answers2

21

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)
horcrux
  • 6,493
  • 6
  • 27
  • 40
John Conde
  • 212,985
  • 98
  • 444
  • 485
1

use

INSERT INTO dbcs.born in VALUES ('Alanis Morissette',1974,1.0)
Akash
  • 4,836
  • 11
  • 40
  • 66