Mysql中关键字需要引号引起来

来源:互联网 发布:推荐算法有哪几类 编辑:程序博客网 时间:2024/05/18 00:46

今天写了一个sql语句怎么也找不到它的错误,

INSERT INTO mes_op_processes
(
machineType_id,
op_id,
`name`,
sequence,
workingHours,
engineering_id,
`replace`,
processes_id,
abandon,
create_date,
create_byUser,
create_byIP
)
VALUES
(
#{machineTypeId},
#{opId},
#{name},
#{sequence},
#{workingHours},
#{engineeringId},
#{replace},
#{processesId},
#{abandon},
#{createDate},
#{createByUser},
#{createByIP}
)

最终才知道是因为Mysql中的关键字的问题,

解决方案

1:有些字是关键字需要引号引起来,(在英文状态下,点1左边的按键)

2:或者字段前带上表名也是安全的!


0 0
原创粉丝点击