当前位置:网站首页>MySQL winter vacation self-study 2022 11 (8)

MySQL winter vacation self-study 2022 11 (8)

2022-07-06 02:25:00 Crane paper thousand

--  Query whether the company has more than 60 Year old employees , Output if there is 

select * from emp3 where exists(select * from emp3 where age > 60);# Wrong writing , Output for the whole table 

select * from emp3 a where exists(select * from emp3 b where a.age > 60);

select * from emp3 where eid in (select eid from emp3 where age > 60);# use in To achieve 

--  Query the employee information of the Department 
select * from emp3 a where exists (select * from dept3 b where a.dept_id = b.deptno);

select * from emp3 a where dept_id in(select deptno from dept3 );# use in To achieve 

Be careful exists Efficiency currency of in high

原网站

版权声明
本文为[Crane paper thousand]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/02/202202140023140900.html