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

Where is all the data on the internet stored?

558


What does the base_object_type column shows in the user.triggers data dictionary view?

578


Explain what is a database?

652


What are the types of operators available in sql?

554


Is sql considered coding?

572






What is difference between function and trigger?

546


How do I truncate a word?

530


How do I save a sql query?

548


What is the size of partition table?

562


i have some prob lem to tell me about my self in interview first round ...

1706


What is foreign key and example?

521


What is difference between primary and secondary key?

519


Where is sql database stored?

520


How do you update a value in sql?

550


what are date and time data types in mysql? : Sql dba

504