+ 3

Another way to change constraints

I've created a table using the following statements: > create table users (user_id int); After a while, I've wanted to change 'user_id' to 'auto_increment', but the following statements does't work: > alter table users change user_id int not null auto_increment; Then, I figured out another way to change this: > alter table users modify user_id int not null auto_increment; And the magic happened!

10th Jul 2017, 4:01 AM
Franco L Dalto
Franco L Dalto - avatar
2 Answers
+ 3
Nice tip!
10th Jul 2017, 4:46 AM
Ipang
0
thanks!
10th Jul 2017, 4:47 AM
Franco L Dalto
Franco L Dalto - avatar