--数据库、模式、表名 "identities"."Test"."tab_test"
--修改字段名
ALTER TABLE "identities"."Test"."tab_test" RENAME "u_name" to realname ;
--添加字段
ALTER TABLE "identities"."Test"."tab_test" ADD COLUMN updcontent VARCHAR(50);
--添加字段 给默认值
ALTER TABLE "identities"."Test"."tab_test" ADD COLUMN utype INT DEFAULT(1);
--字段注解
COMMENT ON COLUMN "identities"."Test"."tab_test"."utype" IS ‘类型 1为普通 2为高级‘;
--修改字段类型
ALTER TABLE "identities"."Test"."tab_test" alter COLUMN utype type VARCHAR(50) ;
--删除非空约束
ALTER TABLE "identities"."Test"."tab_test" ALTER COLUMN realname drop not NULL;
--添加主键
ALTER TABLE "identities"."Test"."tab_test" ADD PRIMARY KEY ("id");
原文地址:https://www.cnblogs.com/telwanggs/p/12172790.html
时间: 2024-10-23 19:55:43