I have table t1 and I would like to add a new column app_id with the properties given below
- auto increment
- increment factor(increment by 4)
- min-value/initial value(100)
- max-value(2000)
I have tried
alter table t4
add column app_id int not null auto_increment = 100 ;
but which is not worked.is it possible to add such a column with the properties mentioned above?
Best Answer
Here, you can use sequence to increase
app_id
value. Please noted if the sequence reach to itsmaxvalue
, you will face this errorERROR: nextval: reached maximum value of sequence
.For example