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?

Answers were Sorted based on User's Feedback



Following are some of the question related to below mentioned query? select e1.salary from empl..

Answer / 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

Following are some of the question related to below mentioned query? select e1.salary from empl..

Answer / 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

Following are some of the question related to below mentioned query? select e1.salary from empl..

Answer / suraj

This query does execute, you stupid.
Have some self respect. Do not post comments unless you are
very sure about it.

Is This Answer Correct ?    1 Yes 0 No

Following are some of the question related to below mentioned query? select e1.salary from empl..

Answer / haris

yah this query works fine and return the 2nd highest salary.

Is This Answer Correct ?    0 Yes 0 No

Following are some of the question related to below mentioned query? select e1.salary from empl..

Answer / chintan

First of all this query doesn't execute. I tried it on SQL
2005 and kept getting error.

Is This Answer Correct ?    0 Yes 5 No

Post New Answer

More SQL Server Interview Questions

Where does the copy job runs in the log shipping primary or secondary? : sql server database administration

0 Answers  


optimization techinques

0 Answers   Wipro,


What happens if you delete a table that is used by a view?

0 Answers  


Difference between rowid and rownum in SQL?

1 Answers   Virtusa,


How many nested transaction can possible in sql server?

3 Answers   Bank Of America,






Can we create nonclustered index in a table without creating a clustered index

1 Answers  


How can you insert null values in a column while inserting the data?

0 Answers  


Where is trigger in sql server?

0 Answers  


how insert selected column only ?

3 Answers   Robert Half,


let's assume you have data that resides on sql server 6.5. You have to move it sql server 7.0. How are you going to do it? : Sql server database administration

0 Answers  


Explain intellisense for query editing

0 Answers  


Which sql server table is used to hold the stored procedure script?

0 Answers  


Categories