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

What is the difference between the Primary and Foreign key?

7 Answers   Cap Gemini,


What are inbuilt functions in sql?

1 Answers  


What is loop in pl sql?

1 Answers  


how to convert character strings to numeric values? : Sql dba

1 Answers  


Can we delete column in sql?

1 Answers  


What is acid property in a database?

1 Answers  


what is 'mysqld'? : Sql dba

1 Answers  


How consistent is the view of the data between and within multiple sessions, transactions or statements ?

1 Answers  


what is a trigger? : Sql dba

1 Answers  


Does google use sql?

1 Answers  


Why do we use sql constraints? Which constraints we can use while creating database in sql?

1 Answers  


what are ddl statements in mysql? : Sql dba

1 Answers  


Categories