Following are some of the question related to below
mentioned query?
select e1.salary from employee3 e1
where 2=
(
select count(distinct(e2.salary))
from employee3 e2 where e2.salary>=e1.salary
)
1) What the query returns?
2) How it works? - Detail explanation (what the sub query
does, why it is (where 2=)....etc...Please?
Answer Posted / ashok
Hi
1.Here query will return 2nd highest salary
2.here 2= i.e 2nd heigest similary if we set N in place
of 2 then it will returen Nth heigest salary
where n =1,2,3,4.....
Hope it will help u
Ashok
| Is This Answer Correct ? | 4 Yes | 0 No |
Post New Answer View All Answers
Why Master database is required?
What is the difference between clustered and non-clustered indexes in ms sql server?
What is a heap?
Why use stored procedures in sql server?
List the advantages of using stored procedures?
How to get the number of affected rows?
How to delete existing triggers using "drop trigger"?
Is a primary key unique?
What is the maximum row of a size?
What is log ldf?
role of sql sever 2005 in database rather than any other database
What is ssrs?
What is the order by used for?
Do you know what is openxml in sql server?
What are the events recorded in a transaction log?