How to read 2nd highest sal from EMP table?
Answers were Sorted based on User's Feedback
Answer / sasikala
select max(salary) from emp where salary<(select max(salary) from emp);
Is This Answer Correct ? | 11 Yes | 0 No |
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 |
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 |
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 |
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 |
what is the Enterprise manager(2000) and management studio (2005)?
What is difference between rownum and row_number?
What is an identity column in insert statements?
How to replace null values in expressions using isnull()?
What is the new security features added in sql server 2016? : sql server security
i need some interview questions on sql server developer plz any onee send some links.
What are the types of sql server?
What is difference between view and materialized view?
What is use of attributehierarchyenabled? : sql server analysis services, ssas
What is bit datatype and what's the information that can be stored inside a bit column?
What is ms sql server index?
How many instances per computer are there in sql server 2000?