How do I find duplicate values in a table in Oracle?

To find duplicate value we need the sql group by & having clause as below.

SELECT V.FIELD_NAME1, COUNT(*) FROM TABLE_NAME V GROUP BY V.FIELD_NAME1 HAVING COUNT(*)>1

How query works?

  1. First it will group the same value by non-clustered index i.e. virtual indexing by oracle in-built.
  2. After grouping of same value, it will calculate the count of rows which is repeatedly.
  3. Query performance will be slower when you use Having clause because it will filter all data from actual output.
Advertisements

About Hiren Kubavat

ORACLE,MYSQL.PHP,JQUERY,JAVASCRIPT,AJAX,HTML,CSS,ANGULAR2,AWS, WORDPRESS,JOOMLA,DRUPAL,CAKEPHP,LARAVEL,CODEIGNITER,MVC & CMS.
This entry was posted in oracle, sql and tagged . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s