Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


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

How do you add a column to a table?

0 Answers  


What does cursor do in sql?

0 Answers  


I need to write a simple query,which one is better select statement or stored procedure?and why?

2 Answers   iGate,


What is the use of triggers?

0 Answers  


What is rownum in sql?

0 Answers  


Which constraints we can use while creating database in sql?

0 Answers  


What is the difference between local variables and global variables?

0 Answers  


which operator is used in query for pattern matching? : Sql dba

0 Answers  


table structure: ---------------- col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10 01-mar-2012 11:12:46 01-mar-2012 11:11:23 Write a query to display the result as shown below: col1 col2 ----- ----- 01-mar-2012 11:12:46 01-mar-2012 11:12:10

2 Answers  


What are the two characteristics of a primary key?

0 Answers  


How do I view stored procedures?

0 Answers  


What is sql profiler in oracle?

0 Answers  


Categories