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
What are entities and relationships?
How would you use user_constraints table in DB?
What is a primary key?
What is policy based management (pbm)? : sql server database administration
What is the purpose of floor function?
Do you know what are the restrictions applicable while creating views? : SQL Server Architecture
What are the differences between decimal and float in ms sql server?
How to find a value in another dataset based on current dataset field (ssrs 2008 r2)?
What is data compression?
What is data source document?
Where the sql logs gets stored? : sql server database administration
What is a DBMS, query, SQL?
Explain filtered indexes benefits?
What is de-normalization in sql database administration? Give examples?
How to concatenate two strings in SQL Server.