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 have a table which has thousand of records i want to
fetch only record num 100 to record num 200. Write a query
that satisfies this criteria.(Cant use any keys)
Anyone please reply ASAP!

Answers were Sorted based on User's Feedback



I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / prasenjit

With reference to Mr.Om......
In the question itself i had mentioned that you are not
supposed to use any keys....so that negates your query
where u have used empno as a key!

Arent there any solution for this?

Is This Answer Correct ?    1 Yes 2 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / saeed

db2 "SELECT EmpNo FROM (SELECT EmpNo, dense_rank() over
(order by EmpNo) RNo FROM office) xyz WHERE RNo >= 100 AND
RNo<=200 "

Is This Answer Correct ?    0 Yes 1 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / vijay reddy

select * from (select * from emp ) where rownum>=1 and rownum<5

Is This Answer Correct ?    0 Yes 1 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / om yadav

mr. Prasenjit ..
when you are going to select 100 record then you select
which column base you want the record taht base you mession
on condition.
than
if any other way please tell me.........

Is This Answer Correct ?    0 Yes 2 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / om prakash yadav

select * from <Table name> where <condition>

condition:- using BETWEEN

eq:-

select * from emp where empno between( 100 to 200).

Is This Answer Correct ?    11 Yes 17 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / om prakash yadav

Note= Before i given the query it is worng pleas ignopre it.
Thanks.
========================================

using cursors you can do>


CURSOR Crs_trs IS
SELECT empno, empname, sal, deptno from emp WHERE empno
between 100 and 200;

vr_empno.empno%type;
vr_empname.empname%type;
vr_sal.sal%type;
vr_deptno.deptno%type;

BEGIN
OPEN Crs_trs;
IF crs_trs%ISOPEN THEN
LOOP
FETCH Crs_trs INTO vr_empno, vr_empname, vr_sal, vr_deptno;

dbms_output.put_line('empno__'||vr_empno );
dbms_output.put_line('empname__'||vr_empname);
dbms_output.put_line('empsalary__'||vr_empsal );
dbms_output.put_line('empdeptno__'|| vr_deptno);

EXIT WHEN Crs_trs%NOTFOUND;
END IF;
END LOOP;
CLOSE Crs_trs;
END;

Is This Answer Correct ?    1 Yes 9 No

I have a table which has thousand of records i want to fetch only record num 100 to record num 200..

Answer / kumar

try this one.....


select * from emp where count(*) > 100 and count (*) < 200;

Is This Answer Correct ?    3 Yes 16 No

Post New Answer

More DB2 Interview Questions

Explain about dbrm.

0 Answers  


SET is the ANSI standard for variable assignment, SELECT is not. SET can only assign one variable at a time, SELECT can make multiple assignments at once. If assigning from a query, SET can only assign a scalar value. If the query returns multiple values/rows then SET will raise an error. SELECT will assign one of the values to the variable and hide the fact that multiple values were returned (so you'd likely never know why something was going wrong elsewhere - have fun troubleshooting that one) When assigning from a query if there is no value returned then SET will assign NULL, where SELECT will not make the assignment at all (so the variable will not be changed from it's previous value) As far as speed differences - there are no direct differences between SET and SELECT. However SELECT's ability to make multiple assignments in one shot does give it a slight speed advantage over SET.

0 Answers  


What is the difference between group by and order by?

2 Answers   IBM, TCS,


How can you quickly find out the number of rows updated after an update statement?

1 Answers   CSI, CTS,


What is pagespace?

1 Answers  


What is data manager?

0 Answers  


What is the connection string to connect to the DB2 Database ?

0 Answers   MCN Solutions,


why db2 is called as universal database?what is the storage capacity of db2v9 n what are the advantages of db2

3 Answers  


What is the difference between bind and rebind in db2?

0 Answers  


where will u check for sqlcode ?

2 Answers   TCS,


What is lock escalation?

2 Answers  


Which isolation level provides highest data integrity?

0 Answers  


Categories