sql中in和exists的区别效率问题 转
1个回答
展开全部
不一样的条件是比不了的。
IN 适合内小外大的查询
Exists 适合内大外小的查询
Select distinct deptName from Department
where exists(select * from Employee where empGender=1)
Select distinct deptName from Department
where deptID in(select FDeptID from Employee where empGender=1)
IN 适合内小外大的查询
Exists 适合内大外小的查询
Select distinct deptName from Department
where exists(select * from Employee where empGender=1)
Select distinct deptName from Department
where deptID in(select FDeptID from Employee where empGender=1)
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询