How will you delete duplicate records from a table?
Answers were Sorted based on User's Feedback
Answer / tharanath.n
delete from table a
where rowid >(select min(rowid) from table b
where a.column = b.column);
| Is This Answer Correct ? | 13 Yes | 5 No |
Answer / ajay kumar ande
question is wrong......records-----files,table-----rows
How will you delete duplicate records(rows) from a table?
pgm=sort
sortin dd dsn=-----
sortout dd dsn=-----
sysin dd *
sort fields=(2,3,ch,a)
sum fields=none ------>eliminates duplicate recs
| Is This Answer Correct ? | 3 Yes | 1 No |
Answer / venkat
delete from emp where ecode IN ( select ecode from emp group by ecode having count(*) >1 )
| Is This Answer Correct ? | 5 Yes | 4 No |
Answer / mehdee
Hi. This is a database design problem, because if you
alowe duplicate rows then you must have at least a column
being like squence number.
| Is This Answer Correct ? | 2 Yes | 2 No |
Answer / naresh.s
in DB2
first we need to know duplicate records in database file
like tmpfilep ,for that
select RRN(A) from tmpfilep A where field='fieldvalue'
here field means any fileld containd tmpfilep and
corresponding value.
once we execute the above query we will get relative record
numbers of each row and remember that numbers
now you can delete records based on these numbers
delete from tmpfilep A where rrn(A) in (234,341,642)
here 234,341,642 are sample record numbers
may be i am correct upto my knowledge.......
| Is This Answer Correct ? | 0 Yes | 0 No |
Answer / king
DELETE FROM FILE WHERE FIELD = ALL(SELECT FIELD FROM FILE
GROUP BY FIELD HAVING COUNT(*) > 1)
OR
DELETE FROM FILE WHERE FIELD = ANY(SELECT FIELD FROM FILE
GROUP BY FIELD HAVING COUNT(*) > 1)
| Is This Answer Correct ? | 1 Yes | 7 No |
Answer / s
DELETE FROM TABLE ABC
WHERE COLUMN =
(SELECT COLUMN FROM TABLE ABC
GROUP BY COLUMN
HAVING COUNT(*) > 1);
| Is This Answer Correct ? | 20 Yes | 36 No |
For unmatched rows returned from an outer join, the column values in the other table are set to null e.g If A OUTER JOIN B returns some unmatched rows from A, the corresponding column values in B will be set to null. What can be done so that a null value is not displayed for these columns?
What are foreign keys in db2?
What is the difference between db2 and oracle?
What is sqlca’s maximum length?
What is an EXPLAIN in DB2. How and what is the steps followed in EXPLAIN command. Can all the queries be used in EXPLAIN command to check the performance.
If I have a view which is a join of two or more tables, can this view be updatable?
What does db2 blu stand for?
What is the use of DELGEN in DB2? Can we Write the program with out using it?
What is a DB2 catalog?
What is a synonym ?
Explain what are the various isolation levels possible?
Explain about mirror activator disk mirroring?