Skip to content

Instantly share code, notes, and snippets.

@dsmrt
Created July 12, 2018 17:13
Show Gist options
  • Save dsmrt/a4f6f267df0bc91654c474b397389891 to your computer and use it in GitHub Desktop.
Save dsmrt/a4f6f267df0bc91654c474b397389891 to your computer and use it in GitHub Desktop.
Mysql - Remove duplicates by adding a unique key.
-- Reference: https://stackoverflow.com/questions/36647058/removing-duplicates-with-unique-index
ALTER IGNORE TABLE mytable ADD UNIQUE INDEX myindex (A, B, C, D);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment