項目:spring boot+mybatis+mysql
報錯:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.jdbc.BadSqlGrammarException:
### Error updating database. Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: 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 'desc,execute_sql,exa_state,trial_name,task_startstop_date,send_ti' at line 12
解決:
一開始百思不得其解,我明明都沒有“send_ti”這個字段。後來看到有人說,“desc”是SQL關鍵字,不能拿來作爲字段名。於是我都改了,就行了。順便說一下,“desc”是降序的意思。
那還需要注意哪些sqk關鍵字?
- order(排序,容易當成訂單)
- like(模糊查詢,容易當成點贊)