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 the maximum size of varchar data type in db2?
What is dclgen in db2?
How to check table size in db2 sap?
My sql statement select avg(salary) from emp yields inaccurate results. Why?
What action db2 takes when a program aborts in the middle of a transaction?
What is explain plan in db2?
What is image copy in db2?
What is a page in db2?
How do you find the maximum value in a column in db2?
What is the difference between cursor stability and repeatable read isolation levels?
Hi Everyone... Under the Logical files, when am working on multiple rec format logical file, I have joined two pf's using the multiple record format logical file concept, but when i run queried the LF only the first mentioned pf records are reflecting and I am not able to see any of the field records specified under the second pf. Kindly let me know whats the reason behind this. Below is the str of LF., R rec PFILE(LOGICAA) CUSTNO CUSTNAME BILL K CUSTNO R rec1 PFILE(LOGICAA1) CUSTNO ADD K CUSTNO .....
What is db2?
Explain dclgen.
What is the difference between db2 and oracle?
Why select is not preferred in embedded sql programs?