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 |
Give SQL Query to find the number words in a sentence ? ex: 'ram charan singh' then ans:3 Answer:select length(trim('ram charan singh')) - length (replace (trim ( 'ram charan singh'),' ','')) +1 from dual The above query working properly when space between the words is only one &similar But ,If the space between the words is nonuniform. Ex:'ram charan singh is good' ans:5 i am not getting this answer using above query.
How to convert characters to dates in oracle?
defination of bitmap index
Will you be able to store pictures in the database?explain.
Is the After report trigger fired if the report execution fails ?
15. Display the item_cost and then truncate it to the nearest hundred, ten, unit, tenth and hundredth.
what is the difference between joins and set operators.i am always confusing with two,can u pls kindly help me .
Explain what are clusters?
How do we get field detail of a table?
What is oracle analytical function?
Given two table employee and department EMP ---------------- empid deptid(fk) Dept --------------------- deptid(pk) deptname que-Write a query to find count of employee in each department. Expected Output- deptid countofEmployee --------------------------- 10 57 20 20 30 15
What SQL query from v$session can you run to show how many sessions are logged in as a particular user account?