Remove duplicates
# Reference from https://www.runoob.com/mysql/mysql-handling-duplicates.html, 201910210056
CREATE TABLE tmp SELECT DISTINCT * from table_name;
DROP TABLE table_name;
ALTER TABLE tmp RENAME TO table_name;
And You can also use the sql command CREATE TABLE tmp SELECT field_1, ..., field_X from table_name GROUP BY field_1, ..., field_X;
to repalce the first command.
Questions need to pay attenion
-
Sets all field’s type to varchar if you don’t know the access data’s type.
-
Adds single quotes for all new data in the insert, update sql command if you not sure the which fields need the quotes.