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 |
What is the latest version of ibm db2?
What is meant by concurrency?
Where are plans stored?
How to get Top 10 Salaries from a Table
My SQL is not performing well. Describe how will you fine tune it?
How does one bind 2 versions of a CICS transaction with the same module name in two different CICS regions that share the same DB2 subsystem?
can we view the access paths created by dbrm ? how ? thx
Do we have any optinon to search part of integer in DB2 as we have for character Like,SUBSTR optins?
why db2 is called as universal database?what is the storage capacity of db2v9 n what are the advantages of db2
SI Stud name Subject Marks Pass/Fail 1 Sham Maths 40 P 1 Sham Physics 50 P 1 Sham Bio 20 F 2 Ram Maths 40 P 2 Ram Physics 50 P 2 Ram Bio 60 P For the above data , write the SQL query for the student who passed in all the subjects . For eg : I want the data of only Ram coz he passed all subjects .
Is it possible to precompile if db2 goes down?
what is a collection?