check whether all the emp numbers are indeed unique.
Answers were Sorted based on User's Feedback
Answer / nagendra
select empno, count(empno)
from emp
group by empno
having count(empno) > 1;
Is This Answer Correct ? | 22 Yes | 4 No |
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 |
Answer / eswar
select empno,count(empno)
from emp group by empno having count(empno)>1;
Is This Answer Correct ? | 1 Yes | 0 No |
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 |
Answer / biswajit rout
SELECT empno,count(*) FROM emp GROUP BY empno;
Is This Answer Correct ? | 0 Yes | 1 No |
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 |
How to get second highest salary from a table
explain primary keys and auto increment fields in mysql : sql dba
How do I add a primary key to a table?
How does postgresql compare to mysql?
What is an Integrity Constraint?
What is row_number () in sql?
Explain the difference between sql and mysql.
What is the first action to perform a query? Suppose I have four tables and five joins and my query is getting slow day by day.
Explian rowid, rownum?
What are the operators used in select statements?
how to include character strings in sql statements? : Sql dba
Explain the usage of WHERE CURRENT OF clause in cursors ?