Start networking and exchanging professional insights

Register now or log in to join your professional community.

Follow

What is the easiest way to remove duplicate rows in a table ?

user-image
Question added by Amine Abdallah Doukara , 1 , Sonatarch
Date Posted: 2016/02/24
Amine Abdallah Doukara
by Amine Abdallah Doukara , 1 , Sonatarch

easiest way  using close group by and having:

 

exemple: table T1 with  colomn A

DELETE     T1 WHERE     A    IN (                SELECT    A                FROM       T1                GROUP BY  A                HAVING       COUNT (*)     > 1              ) ;

GALIB MIRZA GALIB MIRZA
by GALIB MIRZA GALIB MIRZA , Desktop support engineer , wipro infotech

use distinct keyword in your query to remove duplication of data. its actually remove duplicated entry in your result set but its does not permanently removed from data base. for example if we write a query like this way

 

select distinct city  from student;

it will fetched all the cities name associated with table student but do not show same city name(e.g kolkata) even it is entered in  different row. that means if kolkata city is used for multiple student its does not show kolkata for multiple time as distinct is used  

Dineshkumar Murugesan
by Dineshkumar Murugesan , SoftwareEngineer , EasyDesignSystems.Pvt Ltd

Distinct  option is the easiest way to remove Duplicate rows

More Questions Like This

Do you need help in adding the right keywords to your CV? Let our CV writing experts help you.