数据库课程设计 商品库存管理系统 需求分析 业务流程图 数据流程图 关系模式图 物理结构设计 逻辑结构设计
--表七:总库存表
create table totalstorge( pno char(5), wno char(5), total number(5),
storgeupper number(5) not null check(storgeupper>0), storgelower number(5) not null check(storgelower>0) );
--主键约束
alter table totalstorge add constraint totalstorge_pno_wno_pk primary key(pno,wno);
--外键约束
alter table totalstorge add constraint totalstorge_pno_fk foreign key(pno) references products(pno);
alter table totalstorge add constraint totalstorge_wno_fk foreign key(wno) references warehouses(wno);
--表八:
create table priceadjust( pno char(5),
productiondate date not null,
oldprice number(5) not null check(oldprice>0), newprice number(5) not null check(newprice>0) );
--主键约束
alter table priceadjust add constraint priceadjust_pdate_pk primary key(pno,productiondate); --外键约束
alter table priceadjust add constraint priceadjust_pno_fk foreign key(pno) references products(pno);
6.3 插入测试数据
--插入测试数据 --1.商品
insert into products values('p001','薯片',8,3.5); insert into products values('p002','AD钙奶',6,2); insert into products values('p003','清风抽纸',24,10); insert into products values('p004','益达木糖醇',10,12);