أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
You can use Rank() analytical function to achieve this.
the2 nd
SELECT max(salary) FROM Employee WHERE salary NOT IN (SELECT max(salary) FROM Employee)
OR
SELECT FROM Employee E1 WHERE (1) = SELECT COUNT(DISTINCT(E2.Salary)) FROM Employee E2 WHERE E2.Salary > E1.Salary)
the N th
SELECT FROM Employee E1 WHERE (N-1) = SELECT COUNT(DISTINCT(E2.Salary)) FROM Employee E2 WHERE E2.Salary > E1.Salary)
select max(salary)
from employees
where salary < (select max(salary) from employees)
SELECT max(salary) FROM Employee WHERE salary NOT IN (SELECT max(salary) FROM Employee);
select level,max(sal) from emp
where level =2
connect by prior (sal) > sal
group by level
select Max(Sal) from emp where Sal < (select Max(Sal) from emp)
Select salary from
( select salary from employees order by salary desc )
Where rownum=2;
Please notice that rownum is pseudo column
select distinct sal from emp where sal = (select max(e.sal) from emp ewhere sal < (select max(sal) from emp ) ) order by sal desc
select SALARY from EMPLOYEE EMP
where
2=(
select count(distinct SALARY) from EMPLOYEE
where
EMP.SALARY<=SALARY
);
This would work. You may give it a try...
Also you may replace2 with any number n to find nth highest salary.