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

What is orm in sql?

533


What is posting?

603


What is the use of nvl function?

617


Why is normalization important?

536


What is the basic structure of an sql?

569






How exception handling is done in advance pl/sql?

494


What does := mean in pl sql?

553


What is crud diagram?

509


What is the use of double ampersand (&&) in sql queries? Give an example

609


What are the different types of sql commands?

599


What are the basic techniques of indexing?

573


How can you create an empty table from an existing table?

594


What are the steps for performance tuning.

838


what is a trigger? : Sql dba

573


how can we take a backup of a mysql table and how can we restore it. ? : Sql dba

517