创建表 MySQL:
create table test
(id int(10) not null primary key comment '主键id',
amt decimal(18,2) default null comment '金额'
)
comment='测试表'; Oracle:
create table test(
data_dt date,
id varchar2(32) defaule 0 not null primary key,
name varchar2(32) ,
age varchar2(32)
)
COMPRESS PARTITION BY RANGE(data_dt)
internal (numtodsinterval(1,'day'))
(partition t1 values less than (to_date('2022-01-01','YYYY-MM-DD')));
添加表注释:
comment on table t1 is '个人信息';
添加字段注释:
comment on column t1.id is 'id';
comment on column t1.name is '姓名';
comment on column t1.age is '年龄'; Postgresql:
create table test(
data_dt date,
id varchar2(32) ,
name varchar2(32) ,
age varchar2(32)
)
WITH (APPENDONLY=TRUE,COMPRESSTYPE=LZ4,COMPRESSLEVEL=9,ORIENTATION=COLUMN)
DISTRIBUTED BY(ID)
PARTITION BY RANGE(DATA_DT) (START DATE'2024-09-17') INCLUSIVE END (DATE'2024-09-18') EXCLUSIVE );
添加表注释:
comment on table test is '个人信息';
添加字段注释:
comment on column test.id is 'id';
comment on column test.name is '姓名';
comment on column test.age is '年龄';
修改表名
MySQL:
A.rename table oldtableName to newtableName;
B.alter table oldtableName rename to newtableName;
Oracle:
alter table oldtableName rename to newtableName;
修改表注释
MySQL:alter table oldtableName comment '新注释'
Oracle:comment on table 表名 is '表的注释信息';