Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


Find 2nd Highest salery in emp table

Select* from emp where &n=
select * count from emp where (salery >=emp.salery)


Enter n value 2


These query is correct or not. Tell me any other methods.

Answers were Sorted based on User's Feedback



Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / asimananda

SELECT MAX(SAL) FROM EMP WHERE SAL < ( SELECT MAX(SAL) FROM
EMP )

Is This Answer Correct ?    7 Yes 2 No

Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / kb

select top 1 * from emp
where sal < (select max(sal)from emp)
order by sal desc

Is This Answer Correct ?    3 Yes 0 No

Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / lince

select top 1 * from (select distinct top 2 * from emp order by sal desc)t order by sal asc

Is This Answer Correct ?    1 Yes 0 No

Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / r.rajivgandhi

Select max(salary) from emp where salary <(select max
(salary) from emp)

These Query is correct.Try It

Is This Answer Correct ?    0 Yes 0 No

Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / madhu sudhan g

Hii lets consider the table Salary having EMPNO,EMPSal columns
to find the 2nd higest salary

;WITH CTE(Sal,Row)
AS
(
select EMPSal,ROW_NUMBER() OVER(ORDER BY EMPSal) as Row from Salary
)
select sal as Salary from CTE where Row=2

Is This Answer Correct ?    0 Yes 0 No

Find 2nd Highest salery in emp table Select* from emp where &n= select * count from emp whe..

Answer / ramu

by using sub quries we can do
select * from emp where sal=select max(sal) from emp where
sal<select max(sal) from emp;

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More SQL Server Interview Questions

you have developed an application which uses many stored procedures and triggers to update various tables users ocassionally get locking problems which tool is best suited to help you diagnose the problem? : Sql server administration

0 Answers  


Explain user defined views?

0 Answers  


What is 3nf normalization form?

0 Answers  


What are the different editions available in sql server 2000?

0 Answers  


What is "scheduled jobs" or "scheduled tasks"?

0 Answers  


What does COMMIT command do?

0 Answers   Amdocs,


What is row by row processing ?

2 Answers  


Which operator do you use to return all of the rows from one query except rows are returned in a second query?

0 Answers  


What is a database table?

0 Answers  


How do I start sql server agent automatically?

0 Answers  


Explain how to integrate the ssrs reports in application?

0 Answers  


How to connect sql server management studio express to sql server 2005 express?

0 Answers  


Categories