如何在不丢失列数据的情况下更改MySQL表的列位置? [英] How to change the column position of MySQL table without losing column data?

查看:85
本文介绍了如何在不丢失列数据的情况下更改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

这篇关于如何在不丢失列数据的情况下更改MySQL表的列位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆