find out the second highest salary?
Answers were Sorted based on User's Feedback
Answer / digvijay
select max(salary) from emp where salary < Top Salary
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / prem
SQL> select salary from(select salary,rownum a from(select salary from employee order by salary desc))where a=2;
Is This Answer Correct ? | 0 Yes | 0 No |
select max(salary) from employee where salary not in (select max(salary) from employee);
This worked :)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / sujeet sinha
SELECT DISTINCT (a.sal) FROM EMP A WHERE 2 = (SELECT COUNT
(DISTINCT (b.sal)) FROM EMP B WHERE a.sal<=b.sal);
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / mukesh
Second highest Value
select max(user_id) from users
where user_id < (select max (user_id) from users)
Mukesh Narayan SIngh
09873595976
mukeshnsingh22@gmail.com
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / mahendra
SELECT max(salary) FROM Employee WHERE salary NOT IN
(SELECT max(salary) FROM Employee);
Is This Answer Correct ? | 1 Yes | 1 No |
Answer / asit kumar sahu
SELECT DISTINCT SAL FROM EMP E1
WHERE 2=(SELECT COUNT(DISTINCT SAL) FROM EMP E2
WHERE E1.SAL <= E2.SAL);
OUTPUT= 3000
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / new
select max(salary) from users where salary not in (select max(salary) from users)
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / elumalai d
SELECT * FROM (SELECT salary FROM emp ORDER BY salary DESC) WHERE ROWNUM<3;
Is This Answer Correct ? | 0 Yes | 0 No |
Answer / elumalai d
CREATE TABLE emp(ID NUMBER(10),NAME VARCHAR2(100),salary NUMBER(10));
INSERT INTO emp VALUES(100,'Steven',40000);
INSERT INTO emp VALUES(101,'Smith',30000);
INSERT INTO emp VALUES(102,'Ranshow',70000);
INSERT INTO emp VALUES(103,'Handscomp',20000);
INSERT INTO emp VALUES(104,'Mitchel',10000);
INSERT INTO emp VALUES(105,'Clarke',90000);
INSERT INTO emp VALUES(106,'Ponting',50000);
INSERT INTO emp VALUES(107,'Clarke',80000);
INSERT INTO emp VALUES(108,'Marsh',60000);
COMMIT;
SELECT salary FROM emp ORDER BY salary DESC;
--Records
--======
90000
80000
70000
60000
50000
40000
30000
20000
10000
SELECT min(salary) FROM (SELECT salary FROM emp ORDER BY salary DESC) WHERE ROWNUM<3;
Is This Answer Correct ? | 0 Yes | 0 No |
Can we insert data in view oracle?
What is the meaning of recursive hints in oracle?
Explain the importance of .pll extension in oracle?
What are the differences between primary key and unique key?
Database crashes. Corruption is found scattered among the file system neither of your doing nor of Oracles. What database recovery options are available? Database is in archive log mode.
What is forall Statement ?
How to write a query with an inner join in oracle?
What is the difference between substr & instr functions?
What is meant by joins? List out the types of joins.
Is rowid unique in oracle?
What is a sub query? Describe its types?
How to create a table in a specific tablespace?