avatar
求求!waiting online# Database - 数据库
c*o
1
How to get the EmpName from the following table. The EmpName's departments are
('cs' AND 'math').
(TABLE emp)
======================
EmpName Department
avatar
s*c
2
select distinct EmpName
from emp e1
where exists
(select *
from emp e2
where e2.EmpName = e1.EmpName and e2.Department = 'cs') and
exists
(select *
from emp e3
where e3.EmpName = e1.EmpName and e3.Department = 'math');
Are you in interview:-)

are

【在 c*o 的大作中提到】
: How to get the EmpName from the following table. The EmpName's departments are
: ('cs' AND 'math').
: (TABLE emp)
: ======================
: EmpName Department

avatar
c*o
3
Thank you! Is there any other more efficient one?
avatar
k*e
4
select distinct EmpName
from emp e1
where e1.Department = 'cs' and
exists
(select *
from emp e3
where e3.EmpName = e1.EmpName and e3.Department = 'math');

【在 c*o 的大作中提到】
: Thank you! Is there any other more efficient one?
avatar
s*o
5
Select distinct EmpName
From emp e1
Where e1.Department = 'cs'
INTERSECT
Select distinct EmpName
From emp e2
Where e2.Department = 'math'

are

【在 c*o 的大作中提到】
: How to get the EmpName from the following table. The EmpName's departments are
: ('cs' AND 'math').
: (TABLE emp)
: ======================
: EmpName Department

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。