TABLE A TABLE B
EMPNO ENAME EMPNO ENAME
1 A 1 A
2 B 2 B
3 C 3 C
4 D 4 D
5 E 5 E
6 F
7 G
HOW TO GET THE UNMATCHED RECORDS IN SQL QUERY?

Answers were Sorted based on User's Feedback



TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / sayalibsl

select e2.empno, e2.ename from A e1, B e2
where e1.empno!=e2.empno;

Is This Answer Correct ?    15 Yes 5 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / b

select * from B
minus
select * from A;

Is This Answer Correct ?    12 Yes 3 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / bijaylaxmi

select b.empno,b.ename from b where not exists(select * from a
where a.empno=b.empno)

Is This Answer Correct ?    2 Yes 0 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / swastik

SELECT
e2.Empno, e2.Ename
FROM B e2
WHERE e2.Empno NOT IN
                 (
                  SELECT e1.Empno
                  FROM A e1
                 );

Is This Answer Correct ?    1 Yes 0 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / baji

select * from a full outer join b on a.empno=b.empno
minus
select * from a inner join b on a. empno=b.empno;

Is This Answer Correct ?    2 Yes 2 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / raj kumar

selecet empno,ename from table a
minus
select empno,ename from table b

Is This Answer Correct ?    1 Yes 1 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / damy

select * from b where b.empno not in(select a.empno from a);

Is This Answer Correct ?    1 Yes 1 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / arun

select *from B where (empno,ename) not in (Select
empno,ename from A)

Is This Answer Correct ?    0 Yes 0 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / rajesh venati

select b.empno as empno, b.ename as ename from a, b where
a.empno!=b.empno;

Is This Answer Correct ?    0 Yes 2 No

TABLE A TABLE B EMPNO ENAME EMPNO ENAME 1 A ..

Answer / shrawan kumar keshri

select * from A
except
select * from B

Is This Answer Correct ?    1 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

What is a unique key and primary key and foreign key?

0 Answers  


How many parts of a pl sql block are optional?

0 Answers  


what is the difference between delete and truncate statement in sql? : Sql dba

0 Answers  


what is the difference between char_length and length? : Sql dba

0 Answers  


I have 2 Databases. How can create a table in particular database? How can i know the list of tables presented each database?( in oracle 10g)

5 Answers   Relq,






how can stop the sequence with mention the max value and with out mention the max value

1 Answers   Zensar,


What is sql and db2?

0 Answers  


How can I get the number of records affected by a stored procedure?

0 Answers  


What is keys and its types?

0 Answers  


What's the difference between inner join and left join?

0 Answers  


What is extent clause in table space?

1 Answers   TCS,


what is the purpose of update command in oracle?

7 Answers   MBT,


Categories