check whether all the emp numbers are indeed unique.

Answers were Sorted based on User's Feedback



check whether all the emp numbers are indeed unique...

Answer / nagendra

select empno, count(empno)
from emp
group by empno
having count(empno) > 1;

Is This Answer Correct ?    22 Yes 4 No

check whether all the emp numbers are indeed unique...

Answer / santhi kandasamy

In Oracle,

select empno from emp where empno is not null
group by empno
having count(*) >1;

if the above query does not return any rows then you can
consider, empno having unique values.

Is This Answer Correct ?    7 Yes 0 No

check whether all the emp numbers are indeed unique...

Answer / eswar

select empno,count(empno)
from emp group by empno having count(empno)>1;

Is This Answer Correct ?    1 Yes 0 No

check whether all the emp numbers are indeed unique...

Answer / suresh somayajula

in rownum we will use < or <= operators only.

If any one knows this query pls send the answer.

Is This Answer Correct ?    0 Yes 1 No

check whether all the emp numbers are indeed unique...

Answer / biswajit rout

SELECT empno,count(*) FROM emp GROUP BY empno;

Is This Answer Correct ?    0 Yes 1 No

check whether all the emp numbers are indeed unique...

Answer / valli

select rowid from (
select emp_no, rownum() over (emp_no) as Rownum
from emp order_by emp_no,sal
) where rownum > 2

If this query returns no rows then we can say all the emp
numbers are indeed unique.

Regard,
Valli

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More SQL PLSQL Interview Questions

Hi, Can anybody please explain me the flow of the below query. I am not able to understand how this query works. This query is for finding the Nth highest salary.. SELECT DISTINCT (a.sal) FROM EMP A WHERE &N = (SELECT COUNT (DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal); If N = 2 then second highest salary will be the o/p. If N = 3 then third highest salary will be the o/p. and so on.. Thanks, Nitin

5 Answers   Deloitte, Ness Technologies,


What is difference between sql and mysql?

0 Answers  


What does varchar include?

0 Answers  


Is sql open source?

0 Answers  


How to install oracle sql developer?

0 Answers  






The select into statement is most often used to create backup copies of tables or for archiving records?

0 Answers  


What are analytical functions in sql?

0 Answers  


i have a table t1 a math 20 b phy 30 cchemisty 10 a math 40 b phy 23 c che 21 a math15 bphy 33 c che 56 write a quire to find out the max markr of each subject

8 Answers  


How does left join work in sql?

0 Answers  


Does normalization improve performance?

0 Answers  


Can we insert delete data in view?

0 Answers  


What does stand for in sql?

0 Answers  


Categories