Mybatis表名为关键词时出现的错误

1.[42000][1064] 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 ''order' where order_id = 1' at line 3

笔者在学习mybatis时,将表明设置成order关键词,发现报了以上错误

Mybatis表名为关键词时出现的错误

 2.解决方法

use bjpower;
select
          order_id, order_no, sale_datetime, totalAmount, totalQuantity
        from `order`
        where order_id = 1;

将关键词用反顿号括起来即可! 

3.展示

Mybatis表名为关键词时出现的错误

 

 

上一篇:js+html+css轮播图


下一篇:Use single-tenant server-to-server authentication - PowerApps