1、列操作

新增一列:alter table [tbl_name] add column [column_name] [type]

删除一列:alter table [tbl_name] drop [column_name];

修改列名:alter table [tbl_name] rename [column_name] to [column_name_1]; 

修改列类型:alter table [tbl_name] alter COLUMN [column_name] type varchar(255)

2、序列操作

重置序列:alter sequence xxx restart with 1

创建序列:create sequence xxx START with 1 INCREMENT by 1 NO MINVALUE NO MAXVALUE CACHE 1

给某一列赋上序列:alter table [tbl_name] alter column [column_name] set default nextval('xxx')

3、设置主键

alter table [tbl_name] add constraint 'pkey_name' ;

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-05-07
  • 2021-06-23
  • 2021-07-16
  • 2022-01-22
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
  • 2021-12-17
  • 2021-06-14
  • 2021-06-22
  • 2022-01-07
相关资源
相似解决方案