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

how will you retrieve first record in table

1 Answers   UST,


What is RUNSTATS?

3 Answers  


How will fetch last 5 rows from table in db2

6 Answers  


What is a bind in db2?

0 Answers  


What is db2 command?

0 Answers  


What is null indicator in db2?

0 Answers  


what is the syntax for FOR UPDATE CLAUSE in cursor declaration and how can u update using cursor? is it possible to update multiple rows at a time.

2 Answers   Syntel,


What are data types?

2 Answers  


How do you insert a record with a nullable column?

2 Answers  


List some fields from sqlca?

0 Answers  


how 2 resolve the -311 sqlcode

1 Answers  


How to resolve -818 sql code in DB2?

2 Answers   Cap Gemini,


Categories