Communiquez avec les autres et partagez vos connaissances professionnelles

Inscrivez-vous ou connectez-vous pour rejoindre votre communauté professionnelle.

Suivre

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

user-image
Question ajoutée par Amine Abdallah Doukara , 1 , Sonatarch
Date de publication: 2016/02/24
Amine Abdallah Doukara
par 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
par 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
par Dineshkumar Murugesan , SoftwareEngineer , EasyDesignSystems.Pvt Ltd

Distinct  option is the easiest way to remove Duplicate rows

More Questions Like This

Avez-vous besoin d'aide pour créer un CV ayant les mots-clés recherchés par les employeurs?