早教吧 育儿知识 作业答案 考试题库 百科 知识分享

在SQLserver中and和or的执行顺序是什么?select*fromproductswhereunitprice>16andproductid=16orproductnamelike'T%'select*fromproductswhereunitprice>16andproductnamelike'T%'orproductid=16恳请专家说一下这两个语句执

题目详情
在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,一般这种表达式可以用()括起来,