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 most important ddl statements in sql are?

533


What are its different types of dbms?

548


Can we use views in stored procedure?

526


i have a column which may contain this kind of value: 123*67_80,12*8889_5,34*8_874 ,12*7_7 (can contain space before a comma, and this string length can be anything) now i want to split this value into two column like: column1: 123*67,12*8889,34*8,12*7 column2: 80,5,874,7 use function for this

1075


What are sql injection vulnerabilities?

506






what is a relationship and what are they? : Sql dba

561


What is the purpose of the primary key?

578


Can you have a foreign key without a primary key?

517


What do you mean by stored procedures? How do we use it?

540


in oracle 10g sw after compiling procedure how to pass parameter values ,if we (v_empid out number)how to give empid after successful compilation program.This site exact suitable for 10g with respect to question & answer same format , im trying sql browser & sql command prompt using exec procedure name & respective parameters.

1656


Define implicit and explicit cursors.

641


What is the purpose of cursors in pl/sql?

650


Does a join table need a primary key?

541


How is debugging done?

542


What are different types of sql?

572