Exists :Table2 id exists in table1 so it will fetch data from table1 
select * from table1 a where exists  (select distinct  b.Emp_id from table2 b 
where a.emp_id=b.Emp_id ) ;
Not exists : emp_id is not exists from table1 i will return only not exists in table2  
select * from table1 a where not exists (select distinct  b.Emp_id from table2 b 
where a.emp_id=b.Emp_id ) ;


 
 
 
 
 
No comments:
Post a Comment