首页 > 代码库 > Oracle建表脚本记录

Oracle建表脚本记录

--删除
drop table dianfei;
--创建表
create table dianfei
(
uon varchar2(10) not null,
mmonth  varchar2(6) not null,
ddf number(6,2) not null,
djftime date not null,
djfzt varchar2(3) not null,
dsyjf date not null
);
--注释
comment on table dianfei is 电表;
comment on column dianfei.uon is 用户编号(从键);
comment on column dianfei.mmonth is 缴费月份(从键);
comment on column dianfei.ddf is 电费金额;
comment on column dianfei.djftime is 缴费日期;
comment on column dianfei.djfzt is 缴费状态;
comment on column dianfei.dsyjf is 上月缴费日期;
--创建主键,从键
alter table dianfei add constraint pk_dianfei foreign key (uon)
references uuser (uon);
alter table dianfei add constraint pk_dianfeia foreign key (mmonth)
references money (mmonth);

 

Oracle建表脚本记录