網(wǎng)上超市購物車數(shù)據(jù)庫設(shè)計.doc_第1頁
網(wǎng)上超市購物車數(shù)據(jù)庫設(shè)計.doc_第2頁
網(wǎng)上超市購物車數(shù)據(jù)庫設(shè)計.doc_第3頁
網(wǎng)上超市購物車數(shù)據(jù)庫設(shè)計.doc_第4頁
網(wǎng)上超市購物車數(shù)據(jù)庫設(shè)計.doc_第5頁
已閱讀5頁,還剩6頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認領(lǐng)

文檔簡介

網(wǎng)上超市購物車系統(tǒng) 數(shù)據(jù)庫設(shè)計說明書 擬制人 審核人_ 批準(zhǔn)人_ 【2010年3月12日星期五】數(shù)據(jù)庫設(shè)計說明書1.引言1.1編寫目的 自Internet出現(xiàn)以來,大量的信息通過它迅速傳播,突破了原有的通信方式。在網(wǎng)上,不僅可以迅速找到任何方面的相關(guān)內(nèi)容,而且信息的傳遞也較以前快了許多。 2000年,全世界已擁有近10億因特網(wǎng)用戶,有一億多臺計算機互聯(lián),可以交換數(shù)據(jù)的網(wǎng)絡(luò)超過了100萬個,每年在網(wǎng)絡(luò)上的交易次數(shù)超過10億次。電子商務(wù)正是由于這種信息的快速流動和資源的大量集成而悄然崛起,并以驚人的速度發(fā)展著。 提供高效的內(nèi)容豐富的Web商業(yè)服務(wù)是一項連續(xù)不斷的任務(wù),并不是做好了幾個網(wǎng)頁放在那里就可以了。所以,設(shè)計了這個網(wǎng)上超市購物車系統(tǒng),以對電子商務(wù)有進一步的認識。1.2背景a. 待開發(fā)軟件系統(tǒng)的名稱: 網(wǎng)上超市購物車系統(tǒng)b. 本項目的任務(wù)提出者: 石河子大學(xué)c. 本項目開發(fā)者: 嚴(yán)鳳,叢莉莉d. 本項目用戶: 網(wǎng)上購物人群1.3參考資料軟件開發(fā)這點兒事軟件開發(fā)工具手冊 邵志東著程序員指南叢書ASP.NET高級編程 但正剛著ASP.NET網(wǎng)絡(luò)應(yīng)用系統(tǒng)開發(fā)與實例 吳明暉主編 吳丹紅編著2外部設(shè)計2.1支持軟件本數(shù)據(jù)庫主要采用微軟公司的成熟數(shù)據(jù)庫系統(tǒng)SQL Server2000,提供了較為靈活操作簡單的功能,可以為數(shù)據(jù)庫管理員和系統(tǒng)開發(fā)人員提供很好的支持。3結(jié)構(gòu)設(shè)計3.1概念結(jié)構(gòu)設(shè)計本數(shù)據(jù)庫將反映的現(xiàn)實世界中的實體、屬性和它們之間的關(guān)系等的原始數(shù)據(jù)形式,包括各數(shù)據(jù)項、記錄、系、文卷的標(biāo)識符、定義、類型、度量單位和值域,商城首頁:熱門商品:購物清單:3.2 邏輯結(jié)構(gòu)設(shè)計:n1顧客顧客姓名編號MSN郵件地址登錄密碼家庭電話送貨地址購物車數(shù)量單價編號購物時間顧客編號商品上架時間商品描述商品圖片廠家編號商品種類商品編號點擊量優(yōu)惠價單價購買商品編號3.3關(guān)系圖3.3物理結(jié)構(gòu)設(shè)計 Customers用戶表:列名說明類型(長度)備注ID顧客idInt不允許空,主鍵Name顧客名稱Varchar(50)不允許空Password登錄密碼Varchar(50)不允許空Phone家庭電話Varchar(50)允許空Fax傳真號碼Varchar(50)允許空MobilePhone移動電話Varchar(50)允許空E-mail郵件地址Varchar(50)允許空Address詳細地址Varchar(50)允許空Postcode郵政編碼Char(6)允許空QQQQ號Varchar(50)允許空MSNMSN號Varchar(50)允許空 Categories商品分類表:列名說明類型備注ID商品類型idInt(4.)不允許空,主鍵Name商品類型名稱Varchar(50)不允許空Memo商品類型描述Varchar(255)允許空 Products商品表:列名說明類型備注ProductID商品IDInt不允許為空CategoryID分類IDInt不允許為空ModelNumber商品編號Varchar(50)允許為空ModelName商品名稱Varchar(255)允許為空ProductImage商品圖片文件名Varchar(50)允許為空UnitCost單價Money不允許為空Discount折扣Money不允許為空Description描述Varchar(2000)允許為空DateTimed上架時間Smalldatetime不允許為空Clicks點擊量Int不允許為空Sales銷售量Int不允許為空Commend是否推薦Bit不允許為空 Orders訂單表列名訂單ID類型備注ID訂單IDInt不允許為空Memo備注Varchar(2000)允許為空OrderDate下訂單時間Smalldatetime不允許為空CustomerID用戶IDInt不允許為空ShipDate發(fā)貨時間Smalldatetime不允許為空HasSend是否送貨Bit不允許為空HasReceive顧客是否收到Bit不允許為空Payway付款方式Varchar(50)允許為空Carryway送貨方式Varchar(50)允許為空ReceiveAddress收貨地址Varchar(2000)允許為空 OrderDetails訂單詳情表:列名說明類型備注IDIDInt(4)不允許空,主鍵OrderID訂單IDInt(4)不允許空ProductID商品IDInt(4)不允許空Quantity商品數(shù)量Int(4)不允許空UnitCost商品單價Money允許空 Shoppingcart購物車表:列名說明類型備注CartID購物車IDVarchar(50)不允許為空ProductID商品IDInt不允許為空ID用戶IDInt不允許為空Quantity商品數(shù)量Int不允許為空DateTimed購買時間Smalldatetime允許為空Managers管理員表:列名說明類型備注ID管理員主鍵Int不允許為空Name管理員姓名Varchar(50)不允許為空Password管理員密碼Varchar(50)允許為空4.存儲過程腳本:(通過商品名稱查詢商品圖片,單價,商品描述,購買時間)if exists(select * from sysobjects where name=Products_list and type=p)drop procedure Products_listgocreate PROCEDURE dbo.Products_listspname char(50),sptupian char(50) output,danjia money output,spmiaoshu char(250) output,spshijian char(50) outputas select sptupian=ProductImage,danjia=UnitCost,spmiaoshu=Description,spshijian=Datetimed from Productswhere ModelName=spnamegodeclare spname char(50),declare sptupian char(50),declare danjia money ,spmiaoshu char(250),spshijian char(50) set spname=藍寶石exec Products_list spname,sptupian output,danjia output,spmiaoshu output,spshijian outputselect spname as 商品名稱,sptupian as 圖片,danjia as 單價,spmiaoshu as 商品描述,spshijian as 購買時間go(通過商品ID查詢商品名稱,商品數(shù)量,商品單價,商品描述,購物時間,購物車ID)if exists(select * from sysobjects where name=Shoppingcart_list and type=p)drop procedure Shoppingcart_listgocreate PROCEDURE dbo.Shoppingcart_listProductID char(50),spname char(50) output,spshuliang char(50) output,danjia money output,spmiaoshu char(250) output,spshijian char(50) output,gouwuchengID char(50) outputas select spname=ModelName, spshuliang=Quantity,danjia=UnitCost,spmiaoshu=Description,spshijian=ShoppingCart.Datetimed,gouwuchengID=CartID from Products,ShoppingCartwhere ShoppingCart.ProductID=Products.ProductID and Products.ProductID=ProductIDgodeclare ProductID char(50),spname char(50),spshuliang char(50) ,danjia money ,spmiaoshu char(250),spshijian char(50),gouwuchengID char(50)set ProductID=64exec Shoppingcart_list ProductID,spname output,spshuliang output,danjia output,spmiaoshu output,spshijian output,gouwuchengID outputselect ProductID as 商品ID,spname as 商品名稱,spshuliang as 商品數(shù)量,danjia as 商品單價,spmiaoshu as 商品描述,spshijian as 購買時間,gouwuchengID 購物車IDGo5.觸發(fā)器腳本:修改表Products中的ProductID,則表ShoppingCart中的ProductID隨之改變if exists (select * from sysobjects where name =Product_ID and type=tr)drop trigger Product_IDgocreate trigger Product_ID on Products for update asif update(ProductID)begindeclare productID_new char(50),productID_old char(50)select productID_new=ProductID from insertedselect ProductID_old=ProductID from deletedupdate ShoppingCart set ProductID=productID_newwhere ProductID=productID_oldendgoupdate Products set ProductID=99 where ProductID=63goselect * from Productsselect * from ShoppingCart(當(dāng)插入或刪除一個商品ID時,如果ID在1100操作成功,否則提示商品ID超出所存商品ID范圍,無法找到您需要的商品!請核對后重新輸入。)if exists (select * from sysobjects where name =Product and type=tr)drop trigger Productgocreate trigger Product on Products for update,insertas declare productID char(50)select productID=ProductID from insertedif productID0 and productID=100beginprint操作成功完成!returnendprint商品ID超出所存商品ID范圍,無法找到您需要的商品!請核對后重新輸入。rollback Transactiongoinsert into Products (ProductID,CategoryID,ModelNumber,ModelName,Datetimed,Clicks,Sales,Commend)values(78,12,3564N,微波爐,2002-05-13 11:29:00,47,3000,1)goinsert into Products (ProductID,CategoryID,ModelNumber,ModelName,Datetimed,Clicks,Sales,Commend)values(188,11,888N,空氣加濕器,2002-05-13 11:29:00,20,450,1)goselect * from Productsgo6.視圖腳本:SELECT dbo.Orders.ID, dbo.OrdersDetails.ID AS Expr1, dbo.OrdersDetails.OrderID, dbo.OrdersDetails.ProductID, dbo.OrdersDetails.QuantityFROM dbo.Orders INNER JOIN dbo.OrdersDetails ON dbo.Orders.ID = dbo.OrdersDetails.IDSELECT dbo.ShoppingCart.ID, dbo.Products.ProductID, dbo.Products.CategoryID, dbo.Products.ModelNumber, dbo.Products.ModelNameFROM dbo.ShoppingCart INNER JOIN dbo.Products ON dbo.ShoppingCart.ProductID = dbo.Products.ProductID7:數(shù)據(jù)庫恢復(fù)與備份:數(shù)據(jù)庫的完全備份backup database OnlineShop to disk =f:備份數(shù)據(jù)庫OnlineShop with initgo 數(shù)據(jù)庫的恢復(fù)r

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論