how do you count the duplicate records in a table

Answer Posted / sravan

Hi here is another way to solve this

SELECT NAME, COUNT(NAME) FROM TABLE_NAME
WHERE NAME IN (SELECT NAME FROM TABLE_NAME
GROUP BY NAME
HAVING COUNT(NAME)>1)
GROUP BY NAME;

thanks

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How to select random rows from a table?

518


What is offset and limit in sql?

550


how to select unique records from a table? : Sql dba

629


What do we need to check in database testing?

554


Why cannot I use bind variables in ddl/scl statements in dynamic sql?

665






What are the parts of a basic sql query?

510


what is innodb? : Sql dba

575


Can we create clustered index without primary key?

521


Explain what is sql*plus?

670


What are the different parts of a package?

631


How do you copy a table in sql?

561


how can we optimize or increase the speed of a mysql select query? : Sql dba

505


Is it possible for a table to have more than one foreign key?

582


What is a behavioral trigger?

515


Can you rollback after commit?

524