I want to know last five transactions or records from emp
table, from now?
Answers were Sorted based on User's Feedback
Answer / vikram
select * from emp where rowid >( select count(*)-n from emp)
Is This Answer Correct ? | 3 Yes | 1 No |
Answer / nitin
NAME EMP_ID
A 100
B 102
C 103
D 105
E 200
F 201
G 202
H 203
I 204
SELECT * FROM (select * from emp order by emp_id desc)
WHERE rownum <= 5
Is This Answer Correct ? | 13 Yes | 12 No |
Answer / sarmistha
select TOP (5) * from emp order by empid desc
Is This Answer Correct ? | 2 Yes | 1 No |
Answer / basanti meher
select * FROM (SELECT * FROM TEST ORDER BY ROWNUM DESC ) where rownum <=5 ;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / keshav
Select*from emp
Minus
Select * from emp
Rownum<=(select count (*) -5 from emp);
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / newuser
select * from (select * from employee order by rowid desc) t
where rownum<= 5;
Is This Answer Correct ? | 1 Yes | 0 No |
Answer / vasanth
HI,
Include equal to (=) in that query:
select *
from temp_search
minus (select *
from temp_search
where rownum <= (select count(*) - n from
temp_search))
Another example:
select xx.*
from (select rownum rr, a.* from temp_search a) xx
where xx.rr > (select count(1) - n from temp_search)
*- n : no of last tranactions
Is This Answer Correct ? | 4 Yes | 5 No |
create trigger on emp table with last_transaction with datatype as date or timestamp,
now you have to use dml commands on emp table, when ever u done any modifications on the table these will be inserted in
last_transaction with sysdate with last modification time,
based on time we can find out the last transactions
based on
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / sidhu
For ex: emp table, we want last five transaction in emp
select * from emp
minus
select * from emp where rownum <= (select count(*)-&n from emp);
this will work and give the value 5 it will return last five transacitons.
hope this helpful
Is This Answer Correct ? | 0 Yes | 1 No |
Answer / thulasi reddy
select * from emp minus(selecet * from emp where
rownum<(select count(*)_4 from emp))
this will give last records
Is This Answer Correct ? | 0 Yes | 2 No |
What do you mean by “trigger” in sql?
What is aggregate function in sql?
What data types does pl/SQL have?
Dear All, Question for this Week Find out possible error(s) (either at compile time or at runtime) in the following PL/SQL block. State the reason(s) and correct the errors. Declare Cursor C1 is select ename, sal, comm from emp; Begin For i in C1 Loop If i.comm between 299 and 999 then Dbms_output.put_line(i.Ename || ‘ ** Good Commission’); Elsif i.comm > 999 then Dbms_output.put_line(i.Empno || ‘ ** Very Good Commission’); close C1; Else Dbms_output.put_line(i.Ename || ‘ ** ’ ||nvl(i.comm,‘O’)); End if; End Loop; End;
what is transaction? : Sql dba
What is PL/SQL table ?
how can we take a backup of a mysql table and how can we restore it. ? : Sql dba
Is nosql relational?
What is difference between sql and excel?
What is Data Concarency and Consistency?
What is clustered and nonclustered index in sql?
1. what is the exact use of hint in sql. 2. How we can avoid index scan in sql even though index is there in the table.