if there is a table with huge number of records and if i
want to extract only first 3 records from the table, what
query i have to provide to retreive first 3 records
Answer Posted / andank
SELECT * FROM <qualifier>.<table_name>
FETCH FIRST 3 ROWS ONLY
WITH UR;
The above query holds good, if you are thinking to fetch
rows in any specific order. Otherwise make use of "ORDER
BY".
If you want to filter the records bases on some condition
and fetch first 3 rows, make use of WHERE clause. For
example, if you want to see first 3 records of ACCOUNTS
department, use WHERE DEPTID ='Accounts' FETCH FIRST 3 ROWS
ONLY
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is temporal table in db2?
Why do we need reorg in db2?
what is the role of the cursor in db2?
What is cursor in dbms?
What is consistency token in db2?
I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.
What is performance tuning db2?
What is the difference between using bind () and rebind () methods of naming class?
What is the difference between drop table and delete table?
What is the difference between plan and package in db2?
What is dbrm? When it will be created?
List out the three types of page locks that can be held.
Explain about dbrm.
What are the various isolation levels possible?
What do you mean by storage group (stogroup)?