문제

I have table in mysql, it's sutructure:

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.

I added a new column but I dont know how I can set ID's value to UID with alter.

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 ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top