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

I understand Join always perform better than subqueries. Then what is the advantage/use of Subqueries/correlated subqueries etc.,in DB2 programming.Please explain.

0 Answers  


In db2, how do you insert multiple rows in 1 query using a.) Cursors, b.) Normal query?? Give syntax for both.

5 Answers   CTS,


What is the use of COMMAREA ?Minimum how much data we can pass from it?

7 Answers   Cap Gemini,


For a db2 column that is being defined as decimal (11, 2), discuss the cobol picture clause.

0 Answers  


What is check constraint in db2?

0 Answers  






Why might full image copies be faster to implement than an incremental image copy?

4 Answers  


Why do chiropractors use drop table?

0 Answers  


4. A DB2 application is bound with uncommitted Read isolation level.It issues a request that retrieves 20 rows out of 200000 in the table. Which of the following descrbes the rows that are locked as a result of this request? a. None of the rows are locked. B.The retrieved rows are locked. C.The last row of the result set is locked. D.The rows not previously updated by another application are locked.

3 Answers   Wipro,


ther r 2 tables OTTABLE & SALTABLE, add the otamt from OTTABLE to empsal of SALTABLE if eid is matched else add the unmatched from OTTABLE to SALTABLE

0 Answers  


Is db2 a mainframe database?

0 Answers  


What is db2 optimizer?

0 Answers  


What does DSNDB07 database do?

2 Answers  


Categories