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 privilege is needed for a user to delete rows from tables in another schema?
How to use "while" statements in oracle?
interview questions with answer for cts
9. Display the client name and order date for all orders using the JOIN . . . USING method.
when do u go for hash partitioning?
What is not equal to in oracle?
What is the difference between normal and corelated subqueries?
What happens if variable names collide with table/column names?
How to write a left outer join with the where clause in oracle?
How to select some columns from a table in oracle?
What are the differences between blob and clob in oracle?
How can we Update a table with out using UPDATE command?