解決“you have an Error in your sql syntax”錯誤
這個(gè)問題出現(xiàn)的原因在于sql語句中存在語法錯誤。這個(gè)問題涉及的錯誤是:
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 'from graduate-college' at line 6
仔細(xì)檢查后,發(fā)現(xiàn)問題出在一個(gè)多余的逗號。修改后的正確語句如下:
select date-year, college-name , graduate-number , employment-number , id from graduate-college
此外,還可以看到有些字段的名稱包含連字符(-)。在數(shù)據(jù)庫設(shè)計(jì)中,建議使用帕斯卡命名法或蛇形命名法。帕斯卡命名法首字母大寫,而蛇形命名法用下劃線分隔單詞。
select date-year, collegename , graduatenumber , employmentnumber , id from graduatecollege
或者
select `date-year`, `college-name`, `graduate-number`, `employment-number`, `id` from `graduate-college`
? 版權(quán)聲明
文章版權(quán)歸作者所有,未經(jīng)允許請勿轉(zhuǎn)載。
THE END