Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


I want to know last five transactions or records from emp
table, from now?

Answers were Sorted based on User's Feedback



I want to know last five transactions or records from emp table, from now?..

Answer / vikram

select * from emp where rowid >( select count(*)-n from emp)

Is This Answer Correct ?    3 Yes 1 No

I want to know last five transactions or records from emp table, from now?..

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

I want to know last five transactions or records from emp table, from now?..

Answer / sarmistha

select TOP (5) * from emp order by empid desc

Is This Answer Correct ?    2 Yes 1 No

I want to know last five transactions or records from emp table, from now?..

Answer / basanti meher

select * FROM (SELECT * FROM TEST ORDER BY ROWNUM DESC ) where rownum <=5 ;

Is This Answer Correct ?    1 Yes 0 No

I want to know last five transactions or records from emp table, from now?..

Answer / keshav

Select*from emp
Minus
Select * from emp
Rownum<=(select count (*) -5 from emp);

Is This Answer Correct ?    1 Yes 0 No

I want to know last five transactions or records from emp table, from now?..

Answer / newuser

select * from (select * from employee order by rowid desc) t
where rownum<= 5;

Is This Answer Correct ?    1 Yes 0 No

I want to know last five transactions or records from emp table, from now?..

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

I want to know last five transactions or records from emp table, from now?..

Answer / eshwer

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

I want to know last five transactions or records from emp table, from now?..

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

I want to know last five transactions or records from emp table, from now?..

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

Post New Answer

More SQL PLSQL Interview Questions

how to check the 3rd max salary from an employee table? One of the queries used is as follows: select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal). Here in the sub query "select count(distinct(sal)) from emp b where a.sal<=b.sal" or "select count(distinct(sal)) from emp b where a.sal=b.sal" should reveal the same number of rows is in't it? Can any one here please explain me how is this query working perfectly. However, there is another query to get the 3rd highest of salaries of employees that logic I can understand. Pls find the query below. "select min(salary) from emp where salary in(select distinct top 3 salary from emp order by salary desc)" Please explain me how "select sal from emp a where 3=(select count(distinct(sal)) from emp b where a.sal<=b.sal)" works source:http://www.allinterview.com/showanswers/33264.html. Thanks in advance Regards, Karthik.

4 Answers  


how to create a new view in mysql? : Sql dba

0 Answers  


how many values can the set function of mysql take? : Sql dba

0 Answers  


What are sql triggers used for?

0 Answers  


what is difference between procedure and function, procedure and trigger?

8 Answers   iFlex,


What is sql prepared statement?

0 Answers  


Whate is use of MOD function in pl/sql.

3 Answers   Oracle,


How do I run a query in pl sql developer?

0 Answers  


Which operator is used in query for pattern matching?

0 Answers  


What is the difference between syntax error and runtime error?

0 Answers  


Explain some predefined exceptions.

0 Answers  


Is sql workbench free?

0 Answers  


Categories