常用的sql语句

-- 添加字段
alter table hist_trans add (sett_batch_no nvarchar2(50));
alter table hist_trans add (check_time date) ;
alter table hist_trans add (refund_status integer default 0) ;

-- 修改字段
alter table hist_trans modify mch_ev varchar2(100);

-- 删除字段
alter table hist_trans drop column refund_status ; 

-- 添加注释
comment on column hist_trans.refund_status is '退款状态:1为已退款,2为未退款';


-- 添加主键
alter table sys_syspara_info add constraint pk_sys_syspara_info primary key (si_id)

-- 添加外键
alter table sys_syspara_info add constraint fk_systype_ref_syspara foreign key (si_para_id) references sys_syspara_type (st_id);

-- 删除主键
alter table sys_syspara_info drop constraint pk_sys_syspara_info;

-- 删除外键
alter table sys_syspara_info drop constraint fk_systype_ref_syspara;

-- 创建索引
create index index_sb_bank_id on posp_subbranch (sb_bank_id)
tablespace qbposp
  pctfree 10
  initrans 2
  maxtrans 255
  storage
  (
    initial 64k
    next 1m
    minextents 1
    maxextents unlimited
  ) ;


-- 创建序列
create sequence SYS_MER_ROLE_SEQ
minvalue 1
maxvalue 9999999999999999999999999999
start with 91
increment by 1 ;
cache 20;
 
 
-- 创建表
create table posp_news
(
  news_id            integer not null,
  news_title_cn      varchar2(100) not null,
  news_content_cn    varchar2(4000) not null,
  news_status        integer not null,
  news_expirydate    date not null,
  news_send_name     varchar2(50),
  news_send_time     date,
  news_remark        varchar2(1000)
)
tablespace qbposp
  pctfree 10
  initrans 1
  maxtrans 255
  storage
  (
    initial 64k
    next 1m
    minextents 1
    maxextents unlimited
  );
 
 
 
 
 

 

 

 

 

 

 

 

你可能感兴趣的:(sql语句)