1.添加注释的sql
comment on table tableName is '表注释';
comment on column tableName.columnName is '字段注释说明';
comment on table t_cif_ehrlog is 'ehr同步日志表';
comment on column t_cif_ehrlog.id is '流水号';comment on column t_cif_ehrlog.syn_date is '同步年月(yyyy-mm)';comment on column t_cif_ehrlog.interface_type is '接口类型(编码)(ehrCompanyImpl 公司信息;ehrDeptImpl 部门信息;ehrPositionImpl 岗位信息;Impl 基本信息;ehrNationalImpl 证件信息;ehrBirthdayImpl 生日信息;ehrPhoneImpl 电话信息;ehrOrganizationImpl 机构信息;)';comment on column t_cif_ehrlog.create_date is '入库时间(yyyy-mm-dd hh24:mi:ss)';comment on column t_cif_ehrlog.update_date is '更新时间(yyyy-mm-dd hh24:mi:ss)';comment on column t_cif_ehrlog.is_success is '状态(0:成功 1:失败)';comment on column t_cif_ehrlog.error_message is '失败描述';2.创建联合主键的sql
--ehr同步日志表
CREATE TABLE t_cif_EhrLog(Id NUMBER not null, syn_Date VARCHAR2(20) not null, Interface_type VARCHAR2(30) not null, create_date DATE not null, update_date DATE, Is_success VARCHAR2(1) not null, error_message VARCHAR2(1000), CONSTRAINT PK_SIn primary key(syn_Date,Interface_type) );说明:
主键:表中的可以唯一确定一个元组的属性。(通俗的解释就是,主键是可以唯一确定一条记录的列或列的组合)。它的作用是能够准确得定位一条记录。
联合主键也是为了能准确定位表中的唯一记录,一般用于多对多的情况中。