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
What is the difference between truncate and drop statements?
Where do we use pl sql?
what is a foreign key ? : Sql dba
What is the difference between sum and count in sql?
When is the explicit cursor used ?
How do I run a pl sql procedure in sql developer?
What is rank dense_rank and partition in sql?
Can you sum a count in sql?
What are % type and % rowtype?
Is it possible to create the following trigger: before or after update trigger for each row?
write an sql query to get third maximum salary of an employee from a table named employee_table. : Sql dba
what is rollback? : Sql dba
How do I edit a trigger in sql developer?
define sql update statement ? : Sql dba
What is the difference between an inner and outer join?