How to read 2nd highest sal from EMP table?

Answers were Sorted based on User's Feedback



How to read 2nd highest sal from EMP table?..

Answer / sasikala

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

Is This Answer Correct ?    11 Yes 0 No

How to read 2nd highest sal from EMP table?..

Answer / b.kumar

-- USING MS SQL SERVER

SELECT TOP 1 FROM

( SELECT DISTINCT TOP 2 FROM EMP ORDER BY SAL DESC) EMP
ORDER BY SAL ASC

Is This Answer Correct ?    2 Yes 0 No

How to read 2nd highest sal from EMP table?..

Answer / gali kondareddy

SELECT * FROM EMP WHERE SAL =(SELECT MIN(SAL) FROM EMP WHERE SAL IN (SELECT TOP 2 SAL FROM EMP ORDER BY SAL DESC))

Is This Answer Correct ?    1 Yes 0 No

How to read 2nd highest sal from EMP table?..

Answer / sheshu4040

SELECT MAX(EMP_SALARY) FROM EMP
WHERE EMP_SALARY NOT IN (SELECT MAX(EMP_SALARY) FROM EMP)

Is This Answer Correct ?    0 Yes 0 No

How to read 2nd highest sal from EMP table?..

Answer / arnab bhui

Using Oracle........

create table emp
( id number(10),
sal numeric(10,5)
);

SQL> select max(sal) from (( select sal from emp ) minus ( select sal from emp where sal >= all ( select sal from emp )));

Is This Answer Correct ?    1 Yes 2 No

Post New Answer

More SQL Server Interview Questions

what is the Enterprise manager(2000) and management studio (2005)?

2 Answers  


What is difference between rownum and row_number?

0 Answers  


What is an identity column in insert statements?

0 Answers  


How to replace null values in expressions using isnull()?

0 Answers  


What is the new security features added in sql server 2016? : sql server security

0 Answers  






i need some interview questions on sql server developer plz any onee send some links.

2 Answers  


What are the types of sql server?

0 Answers  


What is difference between view and materialized view?

0 Answers  


What is use of attributehierarchyenabled? : sql server analysis services, ssas

0 Answers  


What is bit datatype and what's the information that can be stored inside a bit column?

1 Answers  


What is ms sql server index?

0 Answers  


How many instances per computer are there in sql server 2000?

0 Answers  


Categories