初级问题,where子句中同时包括多个and与or,如果改变的判断条件间顺序是否会影响最终的判断值?

比如
,where col_a = 'a' and col_b = 'b' and col_c = 'c' or col_d = 'd' and col_e = 'e' or col_f = 'f'……
如果改变他们之间的顺序会怎样?
可以通过括号来设置判断的先后次序么?
---------------------------------------------------------------
当然有变化

col_a = 'a' and col_b = 'b' and col_c = 'c' or col_d = 'd' and col_e = 'e' or col_f = 'f'……

(col_a = 'a' and col_b = 'b' and col_c = 'c') or (col_d = 'd' and col_e = 'e') or (col_f = 'f'……)

col_a = 'a' and col_b = 'b' or col_d = 'd' and col_c = 'c' and col_e = 'e' or col_f = 'f'…… ---d,c换了

(col_a = 'a' and col_b = 'b' ) or (col_d = 'd' and col_c = 'c' and col_e = 'e') or (col_f = 'f'……)

---------------------------------------------------------------

判断的顺序not and or 。
可以使用括号来执行先后的顺序。
---------------------------------------------------------------

有OR的话最好用括号……

Published At
Categories with 数据库类
comments powered by Disqus