Suppose there are many duplicate records in a Db2 table.
What is the query to retrive only duplicate records?

Answers were Sorted based on User's Feedback



Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplica..

Answer / gouri

select column_1 from tablename groupby column1 having coun(*)>1

Is This Answer Correct ?    11 Yes 4 No

Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplica..

Answer / chidambara subbu

SELECT City FROM Customers
Group by City
HAVING COUNT(City) > 1

Is This Answer Correct ?    3 Yes 0 No

Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplica..

Answer / sanj

say col1 is having duplicates in table tabA.Then,

select col1 from tabA
group by col1 having (count(col1) > 1)

Is This Answer Correct ?    4 Yes 4 No

Suppose there are many duplicate records in a Db2 table. What is the query to retrive only duplica..

Answer / azharuddinsyed

SELECT <COLUMN_1> FROM TABLENAME
GROUP BY COLUMN_1
HAVING COUNT(COLUMN_1) > 1

OR

SELECT <COLUMN_1> FROM TABLENAME
GROUP BY COLUMN_1
HAVING COUNT(*) > 1

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More DB2 Interview Questions

How can you count the number of rows from a table tab?

0 Answers  


in my project..TEST is db2 8.1 version In PROD it is 7.1 if i do REORG in TEST.. can I use the same REORG jcl with out modification in PROD region (this is DB2 8.1 )? if not, what modification i need to do in my REORG control card?

0 Answers  


Under what circumstances will DB2 allow an SQL statement to update more than one primary key value at a time?

1 Answers  


cursor with hold explain ?

1 Answers   Verizon,


In cursor program-1 can we create another cursor program-2 inside the cursor program-1.If yes how/no why ?

2 Answers   Wipro,






What is a db2 schema?

0 Answers  


wht displays the number of times a query modified ?

2 Answers   TCS,


What is a DB2 plan?

8 Answers  


What type of database is db2?

0 Answers  


What is the difference between db2 and oracle?

0 Answers  


Is db2 a database?

0 Answers  


what are the max. & min. no. of partitions allowed in a partition tablespace?

2 Answers   IBM,


Categories