How to Remove the 3rd highest salary person record from
table?
Answers were Sorted based on User's Feedback
Answer / suresh babu
delete from employees where employee_id in (select
employee_id from employees where 3 =(select count(distinct
e.salary) from employees e
where e.salary >= employees.salary));
| Is This Answer Correct ? | 17 Yes | 1 No |
Answer / khan
DELETE FROM
(SELECT EMP_ID, SALARY, DENSE_RANK() OVER (ORDER BY SALARY DESC) AS CNT FROM EMPLOYEE)
WHERE CNT = 3;
| Is This Answer Correct ? | 9 Yes | 5 No |
Answer / prasanna
DELETE FROM
(SELECT EMP_ID, SALARY, DENSE_RANK() OVER (ORDER BY SALARY
DESC) AS CNT FROM EMPLOYEE)
WHERE CNT = 3;
or
delete from employees where employee_id in (select
employee_id from employees where 2 =(select count(distinct
e.salary) from employees e
where e.salary > employees.salary));
| Is This Answer Correct ? | 3 Yes | 3 No |
Answer / avnish srivastava-test engg fc
select max(salary)from employees
where
salary < (select max(salary)from employees where
salary < (select max(salary) from employees))
| Is This Answer Correct ? | 10 Yes | 11 No |
Answer / jainish
select max(salary)from employees
where
salary < (select max(salary)from employees where
salary < (select max(salary) from employees))
| Is This Answer Correct ? | 4 Yes | 5 No |
Answer / krishna
delete from emp where sal >(select max(sal) from emp where
sal >(select max(sal) from emp where sal >(select max(sal)
from emp)));
| Is This Answer Correct ? | 0 Yes | 2 No |
Answer / nathan
DELETE FROM emp
WHERE empno = (SELECT empno
FROM (SELECT empno, ROWNUM rn
FROM (SELECT empno
FROM emp
ORDER BY sal DESC))
WHERE rn = 3);
| Is This Answer Correct ? | 1 Yes | 3 No |
Answer / basanti
delete from employee where salary(select salary from(select
distinct (salary) from employee where salary is NOT NULL
order by salary desc) where rownum=n);
| Is This Answer Correct ? | 0 Yes | 3 No |
What are the different types of partitions in oracle?
What is the effect of setting the value "CHOOSE" for OPTIMIZER_GOAL, parameter of the ALTER SESSION Command ?
how to get second highest sal of emp table
what is normalisation?what are its uses?
without using count(*) and rownum how can we count total record in a table
What is a procedure in oracle?
How to see the table columns used in an index?
How to do a full database export?
what is integrity constrains?
What are the execution control statements in oracle?
What is a Temporary Segment ?
How to divide query output into groups in oracle?