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



Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno <..

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

Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno <..

Answer / mr. cooooool

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

Shall i use this query to retrieve first 4 records, Select empno, sal from emptbl where empno <..

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

Post New Answer

More DB2 Interview Questions

How and when does the db2 enforces the unique key?

0 Answers  


What is reorg in DB2

3 Answers   Virtusa,


my project is insurance management system,how to explain my work environment in interview?

2 Answers   CGI, Value Labs,


What is db2 bind?

0 Answers  


How is a typical DB2 batch program executed ?

1 Answers  






What is meant by concurrency?

1 Answers  


What do you need to do before you do EXPLAIN?

1 Answers  


What are leaf pages?

3 Answers  


When a COBOL-DB2 program in PRODUCTION is updating main tables and gone for long run, what have to do?

0 Answers   Broadridge,


what is the difference between declaring the cursor in WS section and Procedure division?

1 Answers   HCL,


What is correlation names?

1 Answers  


What is a result table?

1 Answers  


Categories