how will you find out the last three records in a table
with n no of records and delete them

Answers were Sorted based on User's Feedback



how will you find out the last three records in a table with n no of records and delete them..

Answer / aswin

This query cost the performance :
delete from emp where empno in (select empno from (select
empno from emp order by rowid desc) where rownum <= 3)

Is This Answer Correct ?    9 Yes 0 No

how will you find out the last three records in a table with n no of records and delete them..

Answer / ajit

delete from emp
where empno in
(select empno
from emp
minus
select empno
from emp
where rownum <= ( select count(*) - 3
from emp
))

Is This Answer Correct ?    1 Yes 0 No

how will you find out the last three records in a table with n no of records and delete them..

Answer / sudipta santra

delete from
(select * from tab1
minus
select * from tab1 where rownum<n-2 order by rowid)

Is This Answer Correct ?    0 Yes 3 No

Post New Answer

More SQL PLSQL Interview Questions

can a stored procedure call itself or recursive stored procedure? : Sql dba

0 Answers  


How can we solve sql error: ora-00904: invalid identifier?

0 Answers  


Name the operator which is used in the query for pattern matching?

0 Answers  


What is clustered and non-clustered indexes?

4 Answers   Microsoft,


if we give update table_name set column_name= default. what will happen? its given in pl sql block.what will hapen?

5 Answers   iFlex,






What is a unique constraint?

0 Answers  


Which table is left in join?

0 Answers  


What is the basic form of sql query?

0 Answers  


what is sql? : Sql dba

0 Answers  


What are the advantages of pl sql over sql?

0 Answers  


How to get the procedure's, function's name from a package if it is wrapped(both spec & body).

2 Answers  


What are the two different parts of the pl/sql packages?

0 Answers  


Categories