Shall i use this query to retrieve first 4 records,
Select empno, sal from emptbl where empno < 5. like this can
we fetch first 100 records?
Answers were Sorted based on User's Feedback
Answer / madhu t
if empno is a primary key then the records in table are
stored in ascending order of empno. hence we can use empno
< 5 to fetch the first 4 records of table.
There is also a standar query to fetch the first 10/100/200
records as below...
select empno,sal from emptble fetch first 100 rows only;
| Is This Answer Correct ? | 9 Yes | 0 No |
Hi.............
No. you cann't use this.
this query will display records less than 5.
not to for first 4 records.
For exm.
Suppose i have duplicate records like
Empno
1
2
1
1
3
4
then it display all the above records.
b'coz these all r less than 5.
Thanks.
| Is This Answer Correct ? | 9 Yes | 1 No |
Answer / anju
I dont think records are stored in the sorted order of primary key in DB2. It happens only in VSAM!
| Is This Answer Correct ? | 2 Yes | 1 No |
how can you save the query in QMF?IS IT POSSIBLE OR NOT.IF POSSIBLW HOW?
What is the use of db2 optimizer?
What is difference between rollback and commit?
I have a subprogram B calling from mainprogram A.I have opened a cursor in A ,Can i fetch the same cursor in subprogram B , If yes , Please explain the reason?
What are the contents of a dclmgen?
What keyword does an SQL SELECT statement use for a string search?
Explain the use of the WHERE clause?
What are foreign keys in db2?
What is the information associated with sysibm.syslinks table?
Where is the access path logic created by the DB2 Optimizer stored?
wht r the requirements for writing a cobol-db2 pgm ?
Name the lockable units in DB2?