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 is meant by a deadlock situation?
i can create a view with two columns from emp table,, later i need to add one more emp column to existing view.. what is query similarly add one more column to existing primary key constraint.. please give me the solutions
What is an anonymous block?
What is the difference between truncate & delete command?
Explain the relationship among Database, Tablespace and Data file?
How to use "while" statements in oracle?
what is the difference between rollback & commit? can a foreign key has null value?
How to get the Installed Oracle Version Information ?
Explain constraining triggers.
What query tells you how much space a tablespace named test is taking up, and how much space is remaining?
Explain the use of parfile option in exp command.
What is an oracle table?