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
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 |
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 |
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 |
can a stored procedure call itself or recursive stored procedure? : Sql dba
How can we solve sql error: ora-00904: invalid identifier?
Name the operator which is used in the query for pattern matching?
What is clustered and non-clustered indexes?
if we give update table_name set column_name= default. what will happen? its given in pl sql block.what will hapen?
What is a unique constraint?
Which table is left in join?
What is the basic form of sql query?
what is sql? : Sql dba
What are the advantages of pl sql over sql?
How to get the procedure's, function's name from a package if it is wrapped(both spec & body).
What are the two different parts of the pl/sql packages?