Mysql complicated join
1 . 

select E.* from emp E where id in (
select A.eid from (select distinct eid from dep where name = 'Tom')A
left join (select distinct eid from dep where name = 'Paul')B
on A.eid = B.eid where B.eid is null

)


2 .

select E.* from emp E where id not in (
select distinct eid from dep where name = 'Tom'
)