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
Answers were Sorted based on User's Feedback
Answer / 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 |
Answer / hemachandar
select * from table_name
fetch first 3 rows only;
| Is This Answer Correct ? | 2 Yes | 0 No |
Answer / viji
If there is any specific order they have to be fetched then use fetch first 3 records only.
Without order by, fetch first 3 records only will retrieve any 3 records in random order.
| Is This Answer Correct ? | 0 Yes | 0 No |
define clustering index.
How can you quickly find out the number of rows updated after an update statement?
What is difference between rollback and commit?
I have two tables A and B. Both tables are connected with SSN number as foreign key. I want to retrieve a column data from B table. How will you write a query?
How to restart a DB2 program?
how to delete perticular row from table for ex. how you will delete 3rd row from table please answer THANKS IN ADVANCE
the dd name for ksds is dest1 and what is the dd name for alternate index of ksds ? a.dest b.dest1 c.dest1a d.dd1
What is a DB2 access path?
How do you select a row using indexes in db2?
Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?
What is null value in db2?
What is the difference between cursor stability and repeatable read isolation levels?