Follow Our FB Page << CircleMedia.in >> for Daily Laughter. We Post Funny, Viral, Comedy Videos, Memes, Vines...


What is the SQL query to select, delete and get count of
duplicate rows in DB2?

Answers were Sorted based on User's Feedback



What is the SQL query to select, delete and get count of duplicate rows in DB2?..

Answer / igor kramov

DELETE FROM (
SELECT ROWNUMBER() OVER (PARTITION BY c1, c2 ORDER BY c3
DESC) AS rnum FROM t1)
WHERE rnum > 1 ;

the same is for Select\Count

Is This Answer Correct ?    6 Yes 0 No

What is the SQL query to select, delete and get count of duplicate rows in DB2?..

Answer / hkhatri27

SELECT Columns
FROM Table
GROUP BY Columns
HAVING COUNT(*) > 1;

~ Himanshu

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More DB2 Interview Questions

What error I will get if my select query gives multiple row while executing a Cobol-DB2 program.How can I solve it without using a cursor.

4 Answers   Cap Gemini, Verizon,


What is meant by dclgen?

0 Answers  


What is the difference between db2 and oracle?

0 Answers  


What is cursor?

2 Answers  


What is database alias db2?

0 Answers  






What is catalog database in db2?

0 Answers  


When do you use the IMAGECOPY?

4 Answers  


Mention the various locks that are available in db2.

0 Answers  


What is drop table?

0 Answers  


How can we define a table? How can we apply SEARCH ALL on it ?

1 Answers  


Outputs of explain are with matchcols = 0. What does this signify?

0 Answers  


What are the contents of a DCLGEN?

4 Answers   MetLife,






Categories