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 / mah6326955
SELECT empno
FROM (SELECT ROWNUM r, emp_code
FROM emp
ORDER BY empno DESC) t1
WHERE t1.r <= 3
| Is This Answer Correct ? | 9 Yes | 4 No |
Post New Answer View All Answers
How to call a javascript function from pl sql?
what are the advantages a stored procedure? : Sql dba
what is a table in a database ? : Sql dba
what is a trigger? : Sql dba
Can you have more than one key in a database?
How to use transactions efficiently : transact sql
What plvcmt and plvrb does in pl/sql?
Why do we use joins in sql?
How do I tune a sql query?
Can function return multiple values in sql?
describe transaction-safe table types in mysql : sql dba
what are the differences between require and include, include_once and require_once? : Sql dba
Enlist the characteristics of pl/sql?
How do you pronounce sql?
How can you load multi line records? : aql loader