1 )当想将表中一列修改为自动增长时,可用下面命令:Alter table <table name> alter column <column name> set generated always as identity (start with 1,increment by 1)
上面命令是在改一表中列的属性时,在网上找到的很有用。
2)当修改表中一列自动增长的开始值时,可用下面的命令:ALTER TABLE <talbe_name> ALTER COLUMN <column name> RESTART WITH 18;
CREATE TABLE <table name>(
ID INTEGER NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1 )
PRIMARY KEY (ID)
)