【正文】
通過這次課程設(shè)計,加深了我對數(shù)據(jù)庫的理解。一家企業(yè)的商品越多、種類越多、聯(lián)系越緊密,所需要做的統(tǒng)計工作就越多,庫存管理的工作難度就會越大。select * from users。execute pro_adjustprice。 查詢商品編號為p001的倉庫詳細(xì)信息 select * from warehouses where wno =( select wno from totalstorge where pno=39。 查詢供應(yīng)商名稱中帶有‘薯片’的商品記錄 select * from products where pname like 39。delete from products where pno=39。 where pno=39。,12,)。 想商品表中添加一條產(chǎn)品記錄 insert into products values(39。,39。,39。11139。喬歡39。)。,39。insert into users values(39。1234539。u00139。,39。,1000,50,8)。商品編號倉庫編號庫存上限庫存下限 insert into totalstorge values(39。,20, 39。,39。)。, 39。商品編號倉庫編號生產(chǎn)日期入庫量入庫時間 Insert into storgein values(39。20161225 12:5639。s00139。)。,39。 insert into providers values(39。西安盱眙39。s00239。,39。,39。)。,39。西安39。w00239。,39。 insert into warehouses values(39。,39。清風(fēng)抽紙39。,6,2)。 insert into products values(39。p00139。產(chǎn)品表中的信息不能刪除39。)。,39。 return end end觸發(fā)器設(shè)計1.2.3.4.5.6.... 創(chuàng)建觸發(fā)器,限制只能在工作日對該表進(jìn)行插入操作create trigger tri_products_insert before insert on products begin if to_char(sysdatetime,39。 return end else begin if chu_qty(select qty from cunhuo where material_no=material_no) begin select out=39。 return endgo出倉:create proc material_out_pro chudan_no int,kehu_no varchar(10),material_no varchar(10),out_data datetime,chu_qty bigint,kehu_pay bigint,staff_no varchar(10),out varchar(20)=39。 outputas DECLARE n1 int select n1=count(material_no) from material where material_no=material_no if (n1=0) begin select out=39。. 創(chuàng)建一個存儲過程修改商品的保質(zhì)期create procedure pro_ modifydatetime as begin update products set pvaliddate=pvaliddate+3。系統(tǒng)關(guān)鍵技術(shù)實現(xiàn)123456存儲過程設(shè)計1.2.3.4.5.6... 創(chuàng)建一個存儲過程將所有的商品價格都增加一元create procedure pro_adjustprice as begin update products set pprice=pprice+1。 表八 價格調(diào)整表create table priceadjust( pno char(5) not null, productiondatetime datetime not null, oldprice int not null check(oldprice0), newprice int not null check(newprice0) )。 表七總庫存表 create table totalstorge( pno char(5) not null, wno char(5) not null, total int, storgeupper int not null check(storgeupper0), storgelower int not null check(storgelower0) )。 表六出庫表 create table storgeout( pno char(5) not null, wno char(5) not null, productiondatetime datetime not null, storgeoutamount int check(storgeoutamount0), storgeouttime datetime not null )。 表五入庫表 create table storgein( pno char(5) not null, wno char(5) not null, productiondatetime datetime not null, storgeinamount int not null check(storgeinamount0), storgeintime datetime not null )。表四供應(yīng)表 create table supply( pdno char(5) not null, pno char(5) not null, productiondatetime datetime not null, supplydatetime datetime not null, supplyamount int not null check(supplyamount0) )。聯(lián)合主鍵Productiondate生產(chǎn)日期Date 聯(lián)合主鍵Supplydate供應(yīng)日期DateNot nullSupplyamount供應(yīng)量IntNot null ,0. 入庫表(storgein)字段名稱含義字段類型約束Pno商品編號Char(5)外鍵,引用products表的pno字段;聯(lián)合主鍵Wno倉庫編號Char(5)外鍵,引用warehouses表的wno字段;聯(lián)合主鍵Productiondate生產(chǎn)日期Date聯(lián)合主鍵Storgeinamount入庫量