1、AND比OR的优先级高
--Y
select 'Y' from dual where 1=2 and 1=2 or 1=1;
--Y
select 'Y' from dual where (1=2 and 1=2) or 1=1;
--No value
select 'Y' from dual where 1=2 and (1=2 or 1=1);
如下sql:
SELECT COUNT(u.user_id) FROM user_info u WHERE u.user_name='1' AND u.password ='123456' or 1=1 ; (有数据)
SELECT COUNT(u.user_id) FROM user_info u WHERE u.user_name='1' or 1=1AND u.password ='123456' ; (0)