how to get duplicate records from tables?write qurey for this?

Answers were Sorted based on User's Feedback



how to get duplicate records from tables?write qurey for this?..

Answer / anshuman

Select column_name1,column_name2
from table_T
group by column_name1 having count(*)>1

it will give all the duplicates value of column_name1

Is This Answer Correct ?    28 Yes 7 No

how to get duplicate records from tables?write qurey for this?..

Answer / mahesh babu

select column_name,count(*) from table_name group by
column_name having count>1.

Is This Answer Correct ?    6 Yes 2 No

how to get duplicate records from tables?write qurey for this?..

Answer / naresh k

select * from table_name;
The above qurey get duplicate record also because the
database store records like multi-set..
if we want get distinct records then use following query.
select distinct(attribute_name) from table name

Is This Answer Correct ?    0 Yes 15 No

how to get duplicate records from tables?write qurey for this?..

Answer / pandu

To get the duplicate records in a table use the query
Select distinct(deptno) from emp;
reply any one to me am i correct.

Is This Answer Correct ?    2 Yes 26 No

Post New Answer

More DB2 Interview Questions

When is the results table for the query in a DECLARE CURSOR statement created?

5 Answers  


I have a table(product),It contain fields(productname,cost). I want to retrieve the product name ,which cost is second maximum in the table?

10 Answers   Fidelity,


What value the host varible will contain , if null indicator value is -2 ? Will it contain the truncated value or nothing will move ?

3 Answers   Cap Gemini,


what's the error code for Unique Index Violation?

2 Answers  


How to restart a DB2 program?

0 Answers   Cognizant,






What is Skeleton cursor table (SKCT)?

2 Answers  


how to identify the pseudo conversation by seeing the program

2 Answers   DELL,


I have 3 cursors declared. Cursor1 retieves some data. Based on this curso2 will also fetches some data. In cursor3 (using for some updation) I'm using the data retrieved by the above 2 cursor. My question is, while working with cursor3, periodically if I give commit, will all the three crsors will be closed or only cursor3 will be closed?

4 Answers  


What if we try to insert the base table through updatable view , but failed to give a column value which is defined as NOT NULL.

1 Answers   Cap Gemini,


Can i insert bulk records into a db2 table using qmf of spufi only............!!!

2 Answers  


What is a system catalog table in db2?

0 Answers  


What if , we failed to mentioed null indicator in sql select query , that may retrieve null value ?

2 Answers   Cap Gemini,


Categories