syntax error at or near “.“

时间:2025-04-06 12:58:28
### SQL: select ,,, , from user where id = 1
### Cause: : ERROR: syntax error at or near "."
  Position: 34
; bad SQL grammar [];nested exception is : ERROR: syntax error at or near "."
  Position: 34

一、学习如何根据错误信息定位sql问题出在哪儿

思路:

1. ERROR: syntax error at or near “.” Position: 34
这句话的意思是,问题出现在第34个字符附近。

2. 查看sql

select ,,, , from user where id = 1

34个字符是中的特殊符号.,检查这个.特殊符号的附件是否有错误写法。
仔细观察,发现后面没写逗号,导致语法错误

二、错误sql解决

正确的sql:

select ,,,,, from user where id = 1

错误的sql:

select ,,, , from user where id = 1