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 ? | 3 Yes | 0 No |
Post New Answer View All Answers
How do I perform an unattended install of sql server 2000?
What is table-valued sub query?
What is cross join in sql server joins?
How to get a list of columns in a view using "sys.columns" in ms sql server?
What are sp_configure commands and set commands?
wat wil hapn if we give the both read and deny read permission to user?
What is SubQuery in SQL Server 2008
What will be query used to get the list of triggers in a database?
How to check what was the last restore transaction LSN in Log shipping or Mirroring? when we don't have a Monitor or witness server.
what happens on checkpoint? : Sql server database administration
How to return the top 5 rows from a select query in ms sql server?
what is package and it uses and how can u call a package
What is reference section?
Does index slows down insert statements?
What will happen if a column containing char type data is changed to the nchar data type?