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
How many cores do I need for sql server 2016?
What are the different types of collation sensitivity in sql server?
Do you know what is difference between index seek vs. Index scan?
what is the difference between count(*) and count(1) ?
Who is the owner of a schema in ms sql server?
What are the advantages of having an index on the sql server?
How many files can a database contain in sql server?how many types of data files exists in sql server? How many of those files can exist for a single database?
What are page splits? : SQL Server Architecture
Scalability, Availability, Integration with internet, etc.)?
Describe how to use linked server?
what are different types of backups available in sql server? Given a particular scenario, how would you go about choosing a backup plan? : Sql server database administration
How can I get data from a database on another server?
What is difference between group by and having?
How to write the storeprocedure with in the store procedure? and how can we write the store procedure with in a trigger vice versa? plz post me the exact answer?
How check triggers in sql server?