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 |
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?
What does varchar include?
Is sql open source?
How to install oracle sql developer?
The select into statement is most often used to create backup copies of tables or for archiving records?
What are analytical functions in sql?
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
How does left join work in sql?
Does normalization improve performance?
Can we insert delete data in view?
What does stand for in sql?