ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
info       Did you received any Funny E-Mails from your Friends and like to share with rest of our friends? Yeah!! you can post that stuff   HERE
Google
 
Categories  >>  Software  >>  Databases  >>  SQL Server
 
 


 

 
 Oracle interview questions  Oracle Interview Questions
 SQL Server interview questions  SQL Server Interview Questions
 MS Access interview questions  MS Access Interview Questions
 MySQL interview questions  MySQL Interview Questions
 Postgre interview questions  Postgre Interview Questions
 Sybase interview questions  Sybase Interview Questions
 DB Architecture interview questions  DB Architecture Interview Questions
 DB Administration interview questions  DB Administration Interview Questions
 DB Development interview questions  DB Development Interview Questions
 SQL PLSQL interview questions  SQL PLSQL Interview Questions
 Databases AllOther interview questions  Databases AllOther Interview Questions
Question
what is syntex second or third highest salary.


thanks & Regards
Dhirendra sinha
 Question Submitted By :: Virtualdhiru@gmail.com
I also faced this Question!!     Rank Answer Posted By  
 
  Re: what is syntex second or third highest salary. thanks & Regards Dhirendra sinha
Answer
# 1
select min(salary) from salary where salary in(select top 3
salary from salary order by salary desc)
 
Is This Answer Correct ?    3 Yes 1 No
Praveen Singh
 
  Re: what is syntex second or third highest salary. thanks & Regards Dhirendra sinha
Answer
# 2
select top 2(salary) from (select top 3 (salary) from
dbo.employee order by salary desc) 
order by salary
 
Is This Answer Correct ?    2 Yes 1 No
Sagar Dhande
 
 
 
  Re: what is syntex second or third highest salary. thanks & Regards Dhirendra sinha
Answer
# 3
select sal,rownum from (select sal from emp
 order by sal desc)
where rownum<=3
MINUS
 select sal,rownum from (select sal from emp
 order by sal desc)
where rownum<=1
 
Is This Answer Correct ?    0 Yes 4 No
Dipti Saxena
 
  Re: what is syntex second or third highest salary. thanks & Regards Dhirendra sinha
Answer
# 4
select max(sal) from emp e1 where 1< (select count(distinct sal) from emp e2 where e1.sal <= e2.sal)

To make it generic if u want N'th highest salary;

select max(sal) from emp e1 where (N-1)< (select count(distinct sal) from emp e2 where e1.sal <= e2.sal)

And to get the N'th min sal :

select min(sal) from emp e1 where (N-1)< (select count(distinct sal) from emp e2 where e1.sal >= e2.sal)
 
Is This Answer Correct ?    1 Yes 0 No
Satish
 

 
 
 
Other SQL Server Interview Questions
 
  Question Asked @ Answers
 
What is a NOLOCK?  3
wht is normalization?can u explain me in detail? TCS6
What is blocking and how would you troubleshoot it?  1
What are the type of Indexes? which one is best, why?  5
what is for foreign key ?? Sabic3
What is the difference between a stored procedure and a user defined function in sql server? Millennium2
Let us say the SQL Server crashed and you are rebuilding the databases including the master database what procedure to you follow?  2
What are cursors?  8
how to know Who Is Blocking Your SQL Server?  3
How to determine the service pack currently installed on SQL Server? HCL4
how many joins we can write if at all we have n no of tables Tanla-Solutions4
What is a table called, if it does not have neither Cluster nor Non-cluster Index?  1
What is the diff between Static Queries and Dynamic queries give me some examples CSC1
How to tune a stored procedure?  5
How will u get 5 years back record?  4
What is MSDE?  2
What is The Use Of TIMESTAMP DataType in SQL Server 2005?  3
Whether the updations made to the views reflect the original records in the table NIIT5
What is the difference between OLEDB and ODBC CFCI3
what are the joins,primary key,foriegn key, candidate key, super key and expain them? Polaris2
 
For more SQL Server Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com