how do you count the duplicate records in a table

Answer Posted / babu

Try this,
select col1,count(col1) from tab1
group by col1 having count(col1)>1;

If you want to delete these duplicate entries, use:
delete from tab1 where col1 in (select a.col1 from
(select col1,count(col1) from tab1
group by col1 having count(col1)>1) a);

Is This Answer Correct ?    18 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many indexes can be created on a table in sql?

494


what are string data types? : Sql dba

510


How can check sql version from command line?

534


How do we use distinct statement? What is its use?

551


What is the current version of postgresql?

552






Why is normalization important?

536


What is union and union all keyword in sql and what are their differences?

575


What is rowtype?

563


what are set operators in sql? : Sql dba

534


Explain the steps needed to create the scheduled job?

558


What is optimistic concurrency control? : Transact sql

550


Can we create table inside stored procedure?

532


Is there a 64 bit version of ssms?

516


Is progress software supports to ( pl/sql )?

528


Is oracel sql developer written in java?

646