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 |
in a table consist of 1000 records among that i was updated 145 record how could i know that ..list of recently updated record's and where could i see those updated record's....pls help me out....
how will i display the duplicate record's from a table... i don't want to eliminate ...i want to display the duplicate record...for example in my table i have 10 record's like record no(1,2,3,4,2,9,6,1) in this ...so i want to receive duplicates...
what will be the output of the below given query, if no matching records are found : (a.) 0 (b.) null (c.) error select Avg(salary) from TableA where Deptno = 'insurance'
The only place of VSAM KSDS in DB2 is?
Following a db2 update statement, what is the quickest way to compute the total number of updated rows?
Mention some fields that are a part of sqlca.
Mention a credible reason why select* is never given preference in an sql program that has been embedded.
What is release/acquire in bind?
What kind of database is db2?
What is the self-referencing constraint?
How to get the ddl of a table in db2?
Explain the contents that are a part of dclgen.