数据库相关问题
1.保留字
1.1错误案例(2025/5/27)
报错:
java.sql.SQLSyntaxErrorException: 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 'condition, seller_id, create_time, status) VALUES ('1', '1', 1, '鐢靛瓙浜у搧', ' at line 1
at com.mysql.cj.jdbc.exceptions.SQLError.createSQLException(SQLError.java:120)
解决
在 SQL 语句中,将 condition 改为 ` condition `即可
因为 condition 是 MySQL 的保留字,直接使用会导致语法错误。通过使用反引号将其括起来,我们可以告诉 MySQL 这是一个列名而不是保留字。