How do you retrieve the last N records from a table?

Answer Posted / kiran penujuri

This Will give you last 10 records from a table

SELECT EMPNAME,SALARY
FROM
(SELECT EMPNAME,
SALARY,
RANK() OVER(ORDER BY SALARY) SAL_RANK
FROM EMP)
WHERE SAL_RANK < = 10

Is This Answer Correct ?    1 Yes 5 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

what is the difference between delete and truncate commands? : Sql dba

539


How do you update f as m and m as f from the below table testtable?

1090


how to drop an existing index in mysql? : Sql dba

541


What is a subquery in sql?

511


What are the ddl commands?

539






How insert into statements in sql?

595


Why is sharding used?

555


What normalization means?

527


how to fetch common records from two tables? : Sql dba

633


What are different types of queries in sql?

526


Can we call dml statement in function?

543


What are the different operators available in sql?

579


How do I remove sql developer from windows 10?

511


What is a data definition language?

558


Why is the cursor important?

543