为什么SELECT'WHERE id = a如果值是0会返回结果
技术问答
230 人阅读
|
0 人回复
|
2023-09-12
|
Table preview Note: 'id' is an integer column (offcourse) ------------- | id | value | ---- -------- | 0 | abc || 1 | def | ------------- 查询:6 c$ a6 Y/ r( c- t5 ~$ U. M
1.返回abc:SELECT value FROM table WHERE id = 0
& ~2 A3 |9 a- k2.返回def:SELECT value FROM table WHERE id = 1
+ ~7 U$ X4 {; {3.不返回任何内容:SELECT value FROM table WHERE id = 2
" P' q l# ^0 i9 q( [5 _' h& `% M4.返回abc:SELECT value FROM table WHERE id = 'a'
0 Z! i# v7 a3 V7 p* ?2 O问题: 为什么查询4返回?abc?应该没有结果吧?
# Q- T7 X- P6 u2 H! ~ ; [4 i. \ v: s* H% s' m- k
解决方案: |
|
|
|
|
|