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


Please Help Members By Posting Answers For Below Questions

How you would rewrite the sql query to return the customerid sorted numerically?

755


Which language rdl files made of?

114


What are the triggers in sql?

740


What is subquery in sql?

734


What do you understand by replication in sql server? Mention the different types of replication in sql server.

694






What is the largest component inside a field?

744


What is Extended user-defined?

709


Explain time data type in sal server 2008?

714


How do I open port 1433?

694


What are extended events in sql server?

670


What is the difference between mysql and sql server?

652


How adventureworkslt tables are related?

679


Determine how to use the inserted and deleted pseudo tables?

725


what is a schema in sql server 2005? : Sql server database administration

689


How to end a stored procedure properly in ms sql server?

750