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 |
How do you add a column to a table?
What does cursor do in sql?
I need to write a simple query,which one is better select statement or stored procedure?and why?
What is the use of triggers?
What is rownum in sql?
Which constraints we can use while creating database in sql?
What is the difference between local variables and global variables?
which operator is used in query for pattern matching? : Sql dba
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
What are the two characteristics of a primary key?
How do I view stored procedures?
What is sql profiler in oracle?
Oracle (3259)
SQL Server (4518)
MS Access (429)
MySQL (1402)
Postgre (483)
Sybase (267)
DB Architecture (141)
DB Administration (291)
DB Development (113)
SQL PLSQL (3330)
MongoDB (502)
IBM Informix (50)
Neo4j (82)
InfluxDB (0)
Apache CouchDB (44)
Firebird (5)
Database Management (1411)
Databases AllOther (288)