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
Explain the significance of the & and && operators in pl sql.
What is user defined functions?
Is trigger a stored procedure?
what happens when the column is set to auto increment and you reach the maximum value for that table? : Sql dba
What is the difference between database trigger and stored procedure?
Can we insert data into materialized view?
How do you change a value in sql?
What is the file extension for sql database?
List the various privileges that a user can grant to another user?
What is sql*loader and what is it used for? : aql loader
What is the most important ddl statements in sql are?
What is the use of primary key?
What is a left join?
What has stored procedures in sql?
What is autocommit sql?