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 / swastik

SELECT * FROM
(
SELECT * FROM Emp
ORDER BY ROWNUM DESC
)
WHERE ROWNUM <= 3;

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is sql in mysql? : Sql dba

821


What is difference between nchar and nvarchar?

695


what is the syntax for using sql_variant_property? : Transact sql

708


What are the disadvantages of file system?

830


What is input buffer in sql*plus?

825






Mention what is the use of function "module procedure" in pl/sql?

784


1. is it possible to use the cursor atttibutes (%found ,% rowcount , %isopen , %notfound ) to our user defined cursor names ....... cursor cursor_name is select * from scott.emp if you use... cursor_name%found , %rowcount ,%isopen,%notfound...will it work... -------------------------- 2.what is the difference between the varray and index by table .. -------- 3. type type_name is table of number(8,3) index by binary_integer; identifier_name type_name; first , last , prior , next ,trim are the methods we can use it for the above type...simillary is there any way to apply for cursors... with thanks and regards..sarao...

2172


What is difference between ms sql and mysql?

666


What is trigger types of trigger?

722


What is the difference between subquery and correlated query?

726


What is difference between stored function and application function?

760


what are the different type of normalization? : Sql dba

765


how to check myisam tables for errors? : Sql dba

883


what is bcp? When is it used?

772


how many columns can be used for creating index? : Sql dba

675