mysql 如何处理关键字冲突呢?


摘要:
今天在编写输入插入脚本时,发现同事竟然定义了一个列名为“describe”的数据列,当我编写一个数据插入脚本,就报相应的错误
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘describe ******

例:
1、向数据表”maomao”中插入数据
insert into maomao(describe,keyId ) values ( ‘sqlBlog’,8)

2、显示如下错误信息

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘describe,keyId ) values ( ‘sqlBlog’,8) at line 1

3、解决此类异常的方法,在 describe左右加上“(`describe`)

    insert into maomao(`describe`,keyId ) values ( 'sqlBlog',8)