在SQL server中and和or的执行顺序是什么?select *from productswhere unitprice>16 and productid=16 or productname like 'T%'select *from productswhere unitprice>16 and productname like 'T%' or productid=16恳请专家说一下这两个语句执

来源:学生作业学帮网 编辑:学帮网 时间:2024/05/15 01:24:26

在SQL server中and和or的执行顺序是什么?
select *
from products
where unitprice>16 and productid=16 or productname like 'T%'
select *
from products
where unitprice>16 and productname like 'T%' or productid=16
恳请专家说一下这两个语句执行过程有什么不一样?

第一个查询单价大于16且产品编号是16的,或产品名称以T开头的产品.
第二个是查询单价大于16且产品名称以T开头 或者产品编号是16的.
and优先级高于or,一般这种表达式可以用()括起来,