find out the second highest salary?
Answer Posted / 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 |
Post New Answer View All Answers
Can we convert a date to char in oracle and if so, what would be the syntax?
How many file formats are supported to export data?
What is the difference between a hot backup and a cold backup in oracle?
How to drop an index in oracle?
How to loop through data rows in the implicit cursor?
What is using clause and give example?
What are triggers in oracle?
What is the difference between pre-select and pre-query?
What is the difference between alert log file and tarce file ?
How to drop an index?
definition of cluster and non-clustered index?
What are privileges and grants?
How do I find my oracle client driver version?
Explain database link?
What is oracle data type?