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
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 |
Answer / vijay reddy
select * from (select * from emp ) where rownum>=1 and rownum<5
| Is This Answer Correct ? | 0 Yes | 1 No |
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 |
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 |
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 |
Answer / kumar
try this one.....
select * from emp where count(*) > 100 and count (*) < 200;
| Is This Answer Correct ? | 3 Yes | 16 No |
What techniques are used to retrieve data from more than one table in a single SQL statement?
What is the difference between primary key & unique index ?
What are leaf pages?
Mention the length of physical storage of the given data types of db2 – date, timestamp, time
What is the COBOL picture clause for a DB2 column defined as DECIMAL(11,2)?
What is the SQL Communications Area and what are some of its key fields?
what is the steps followed in EXPLAIN Process or EXPLAIN command. (Explain is for identifying the optimized access path but how or what is the steps for doing the EXPLAIN)
What is the difference between spufi and qmf?
can all users have the privilage to use the sql statement select * (dml)?
What happens to a tablespace when its recovery infromation has been removed and a full recovery is no longer possible?
How is a typical DB2 batch program executed ?
What is ACQUIRE/RELEASE in BIND?