ORACLE中AND与OR的优先级

前端之家收集整理的这篇文章主要介绍了ORACLE中AND与OR的优先级前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

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)

原文链接:https://www.f2er.com/oracle/213217.html

猜你在找的Oracle相关文章