how to retrieve last tree records from table?
select *from emp where rownum > (select count(*)-3 from
emp);
i am using this query to get last three records from table
but its not giving any output, so please tell me what is the
error in this query.
Answer Posted / ashwin
if emp table is having 10 records then
1)for first 6 write
select ename,sal from(select ename,sal from emp order by sal
desc) where rownum <7;
2)for last 3 write
select ename,sal from(select ename,sal from emp order by sal
desc) where rownum >7;
| Is This Answer Correct ? | 2 Yes | 3 No |
Post New Answer View All Answers
What is an alias command?
Which query operators in sql is used for pattern matching?
How do I create a memory optimized filegroup?
Explain constraints in sql?
What is the difference between local and global temporary table?
Explain the significance of the & and && operators in pl sql.
What is a sql trace file?
What are the qualities of 2nf?
Is there any restriction on the use of union in embedded sql?
What is sql dialect?
What is the sql query to display the current date?
What are field types?
What is sql trigger example?
What is the main difference between sql and pl/sql?
What is schema in sql?