我有一个如下的表格:
| id | name | color |
------+--------+---------
| 1 | pear | green |
| 2 | apple | red |
| 3 | banana | yellow |
| 4 | grape | purple |
我想按“名称”列的字母顺序重新排序,并使用这个新的顺序重置id(自动增量)以得到以下结果:
| id | name | color |
------+--------+---------
| 1 | apple | red |
| 2 | banana | yellow |
| 3 | grape | purple |
| 4 | pear | green |
问题:如何使用MYSQL完成这个任务?