0

my table header is follow:
id:name:key:value

when insert something using below sql syntax shows error:
insert table( name, key, value) value ("jack","mobile","18561436678")

justDoIt
  • 13
  • 5
  • There is `"` missing that's why you are getting error. `"18561436678` should be `"18561436678"` – Ayaz Ali Shah Jan 15 '19 at 07:46
  • 2
    Possible duplicate of [How do I escape reserved words used as column names? MySQL/Create Table](https://stackoverflow.com/questions/2889871/how-do-i-escape-reserved-words-used-as-column-names-mysql-create-table) – Robert Kock Jan 15 '19 at 07:57
  • 1
    `key` is a reserved word, you need to escape it in backticks i.e. `\`key\`` – Nick Jan 15 '19 at 08:00

2 Answers2

2

Do it like this:

 insert table( `name`, `key`, `value`) value ("jack","mobile","18561436678");
Wijdan
  • 203
  • 3
  • 12
0

OH , I found the answer by Google,
the reason is table column name "key" is conflicted with mysql definded some word, should use below:
insert table( name,key,value) value ("jack","mobile","18561436678")

key to `key`
value to `vlue`
justDoIt
  • 13
  • 5