如何在不丢失列数据的情况下更改MySQL表的列位置?
问题描述:
我想更改数据库表的列位置而不丢失数据.
I want to change the column positions of my database table without losing data.
例如:
当前表:
+----+------+-------+----------+
| id | name | email | password |
+----+------+-------+----------+
到
+----+----------+------+-------+
| id | password | name | email |
+----+----------+------+-------+
答
尝试一下:
ALTER TABLE table_name MODIFY password varchar(20) AFTER id