Alter IGNORE table rank add unique key (LANGUAGE, RANKING);
Mysql Query for the method of deleting duplicates:
a. Create temporary table tmp_tbl as select Distinct * from org_table;
As, I have used distinct keyword, no duplicate rows will come into new table. Same result will be achieved by using these two queries one by one:
A.1> Create temporary table tmp_tbl (ID int, LANGUAGE varchar (20), RANKING smallint(2)) type = Heap; A.2> Insert into tmp_tbl (ID, LANGUAGE, RANKING) select distinct ID, LANGUAGE, RANKING from org_table;
B> truncate table org_table, or Delete from org_table;
C> Insert into org_table (ID, LANGUAGE, RANKING) select ID, LANGUAGE, RANKING from tmp_tbl;
Now, my original table does not have any duplicate records.