简体   繁体   English

更改表添加列和设置值

[英]Alter table add column and set value

I have table in mysql, it's sutructure: 我在mysql中有表,它的结构是:

ID|    text|    content
1 |     bla|     sadas|
2 |     bla|     sadas|
3 |     bla|     sadas|
4 |     bla|     sadas|

I want to add new column "UID" with "alter table" and set ID's value to UID. 我想用“ alter table”添加新列“ UID”,并将ID的值设置为UID。

I added a new column but I dont know how I can set ID's value to UID with alter. 我添加了一个新列,但我不知道如何使用alter将ID的值设置为UID。

UID|    ID|    text|    content
 1 |    1 |     bla|     sadas|
 2 |    2 |     bla|     sadas|
 3 |    3 |     bla|     sadas|
 4 |    4 |     bla|     sadas|

Sorry, if I have written something wrong in the question, my english not good. 对不起,如果我在问题中写错了话,我的英语不好。

Thanks. 谢谢。

update your_table
set uid = id

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM