表的新建

-- Create table
create table T_HQ_JNGF
(
mingc VARCHAR2(100) not null,
nianx DATE,
shengcrq DATE,
pinz CHAR(1),
xingh NUMBER not null,
baozq DATE
)
tablespace TEST
pctfree 10
initrans 1
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);


-- Add comments to the columns
comment on column T_HQ_JNGF.mingc
is '名称';
comment on column T_HQ_JNGF.nianx
is '年限';
comment on column T_HQ_JNGF.shengcrq
is '生产日期';
comment on column T_HQ_JNGF.pinz
is '品种 1:红酒 2:白酒';
comment on column T_HQ_JNGF.xingh
is '型号';
comment on column T_HQ_JNGF.baozq
is '保质期';
-- Create/Recreate primary, unique and foreign key constraints
alter table T_HQ_JNGF
add constraint XINGH primary key (XINGH)
using index
tablespace TEST
pctfree 10
initrans 2
maxtrans 255
storage
(
initial 64K
minextents 1
maxextents unlimited
);


-- Create/Recreate check constraints
alter table T_HQ_JNGF
add constraint CHECK_NIANX
check (nianx > shengcrq and nianx < baozq);
-- Create sequence
create sequence XINGH
minvalue 1
maxvalue 99999999
start with 100
increment by 1
cache 100;

原文地址:https://www.cnblogs.com/azhulei-1/p/4913309.html