DM数据库给列增加注释
1、创建表
CREATE TABLE test222
(
id int NOT NULL PRIMARY KEY,
name varchar(1000) DEFAULT NULL,
email varchar(1000) DEFAULT NULL,
phone varchar(1000) DEFAULT NULL
)
2、给列添加注释
comment on column TEST222.NAME is '这是一个列注释';
例如:
comment on column TEST222.NAME is '姓名';
comment on column TEST222.EMAIL is '邮箱';
comment on column TEST222.PHONE is '电话';
Oracle
1、创建表
create table student(
id int primary key,
name varchar2(1000),
email varchar2(1000),
phone varchar2(1000)
)
2、给列添加注释
comment on column student.name is '姓名';
comment on column student.email is '邮箱';
comment on column student.phone is '电话';
comment on table student is '测试表'
GaussDB
openGauss和postgressql的SQL类似
1、创建表
CREATE TABLE test.student(
id int,
name varchar(1000),
email varchar(1000),
phone varchar(1000)
)
2、添加备注
COMMENT ON COLUMN test.student."id" IS '编号';
COMMENT ON COLUMN test.student."name" IS '名称';
COMMENT ON COLUMN test.student."email" IS '邮箱';
COMMENT ON COLUMN test.student."phone" IS '手机';
参考:PostgreSQL 创建表时如何为列添加注释|极客笔记 (deepinout.com)
Kingbase8(人大金仓数据库)给列增加备注
1、创建表
CREATE TABLE test (
id int,
name varchar(1000) ,
email varchar(1000) ,
phone varchar(1000) ,
CONSTRAINT test_pkey PRIMARY KEY (id)
);
2、给列添加注释
单独执行sql添加注释:comment ON column 表名.列名 is '注释';
例如:
comment ON column regre.public.test.name is '名称';
comment ON column regre.public.test.email is '邮箱';
comment ON column regre.public.test.phone is '电话';
Hive修改列备注
1、创建表
CREATE TABLE test(
id int,
name varchar(1000),
email varchar(1000),
phone varchar(1000)
)
2、修改备注
alter table test change column name name varchar(1000) comment '姓名';
alter table test change column email email varchar(1000) comment '邮箱';
alter table test change column phone phone varchar(1000) comment '电话';
alter table test change column name name string comment '姓名';
3、添加带有列注释的表
CREATE TABLE test(
id int,
name varchar(1000) comment '姓名',
email varchar(1000) comment '邮箱',
phone varchar(1000) comment '电话'
)