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 |
Once you create a view, where would information about the view be stored?
Which component is responsible for processing sql statements and selecting access paths?
Explain package in db2 and its advantages?
List out the data types available.
db2 maintains information about the data... a.in tables. b.in a set of tables known as db2 catalog. c.in db2 database. d.none of the above.
How do you retrieve the data from a nullable column?
How many sub queries can you combine together ?
How do you declare a host variable (in COBOL) for an attribute named emp-name of type VARCHAR(25) ?
Q4. How will you get the count of record without using COUNT verb in query?
Is db2 a mainframe database?
Which catalog table stores referential constraints?
What is the difference between CS and RR isolation levels?