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 |
Please help me how to write a Query to change the primary key constraint from 1 attribute to another attribute in a table
What do you mean by cdb and pdb in oracle 12c?
How translate command is different from replace?
How to define and use table alias names in oracle?
How are extents allocated to a segment?
what is the difference between data migration and production migration.
Youre getting high busy buffer waits - how can you find whats causing it?
How to use an explicit cursor without open statements?
Which are the five query types available in oracle?
How can I combine multiple rows into a comma-delimited list in oracle?
What is the order of defining local variables and sub procedures/functions?
How to build data dictionary view an new database?