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
List down the data types in the db2 database.
What is deadlock in db2?
What is bufferpool in db2?
Mention the definition of cobol in varchar field.
How to find the number of rows in db2 tables?
What is alias in db2?
How do I add a column to a table in db2?
What is precompiler in db2?
What is schema in db2?
What is role in db2?
What is host variable in db2 cobol?
What parameters are used to control the free space in DB2?
Is db2 free?
What does sqlcabc has?
What is null indicator in db2?