I want to delete all duplicate rows from Mysql table.
But problem is that I did not know which rows are duplicate.
This Mysql table contain a large data round about 500000 rows.
In which some rows are duplicate.
Please guide me how can I do this.
UPDATE:
I need SQL query which I run in phpMyAdmin.
Here is a rough table to understand.
Suppose table name is foo.
+---------------------------------------------------------------------+
| id | link | title | description |
+---------------------------------------------------------------------+
| 1 | google | search engine | search here free |
| 2 | yahoo | also search engine | findout web easily |
| 3 | Facebook| connect with world | meet with world |
| 4 | google | search engine | search here free |
| 5 | msn | Microsoft network | network by MS |
| 6 | google | search engine | search here free |
| 7 | msn | Microsoft network | network by MS |
| 8 | yahoo | also search engine | findout web easily |
| 9 | myweb | my website | ideal website |
|... | .... | .....continue.... | ..... ... ..... |
+---------------------------------------------------------------------+
This is a rough table I can not define my table fully because it had round about 500000
rows.Hope this understand you what I want.
I rough query like that.
DELECT all duplicate rows FROM foo
EDIT
I see this questoin is marked as duplicate.But I think it is unique.The link with this you compare it dulpicate.I see this link and there is answer which is marked for usefull for small size table it make changes in index and make unique index. Here is the code of that
ALTER IGNORE TABLE jobs ADD UNIQUE INDEX idx_name (site_id, title, company );
If you run this query after this when ever you add any data Mysql check out that it is already present or not if present it stop to adding this.
I already told you that my table is contaning a large data if use this query and after that
I add one result in my table it check my whole table in which round about 500000 rows for make it uniquness this make it slow.It is only one new record if this is 10 or Whats your idea about if I want to enter 100000 new records it make too slower it.
And I see other answer most of them are containing HAVING
class.It is already slow.