Check out example codes for "mysql delete duplicate rows except one". It will help you in understanding the concepts better.

Code Example 1

DELETE FROM NAMES
 WHERE id NOT IN (SELECT * 
                    FROM (SELECT MIN(n.id)
                            FROM NAMES n
                        GROUP BY n.name) x)

Learn ReactJs, React Native from akashmittal.com