"Alter ignore" + "unique key" to remove duplicates, mysql and sql server

I have a table containing multiple duplicate values ​​for 1 column, i.e. with a table emails

id email
1  test@test.com
2  test@test.com
3  more@most.many 
4  cook@sheep.com

I want to delete a line with id '2'. And I would like to do this by creating a unique index email, forcing the table to reset the redundancy.

I saw the method mentioned here ( http://www.it-iss.com/mysql/sql-removing-duplicate-records/ ) and https://stackoverflow.com/questions/19000050/how-to-delete-first- of-a-double-record-with-alter-ignore-command-in-mysql

But when I try to make an expression alter ignore table emails_test add unique index(email)

I get a double input error for test@test.com , as if I never included the keywordignore

-, ? , , , , , MySQL 1093 - FROM

+4
1

:

CREATE TABLE _emails LIKE emails
ALTER TABLE _emails ADD UNIQUE INDEX(email)
INSERT IGNORE INTO _emails SELECT * FROM emails
RENAME TABLE emails TO emails_old, _emails TO emails
+11

All Articles