网上购物车数据库设计_第1页
网上购物车数据库设计_第2页
网上购物车数据库设计_第3页
网上购物车数据库设计_第4页
网上购物车数据库设计_第5页
已阅读5页,还剩2页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、精品文档 一、概述 网上购物店的数据模型,它主要模式有产品:product ,帐户:Account,定单: Order。和产品相关的表有 category ,product,item, inventory, supplier; 和用户相关表有的accou nt ,sig non , profile ;和定单相关的表有 orders,orderstatus,lineitem,他们之间的整体关系如下. ERD图 FK:Foreig n Key 二、帐户模型 帐户模型,记录者用户的登录名称,密码。以及个人信息如地址,性名,电话等, 还有它在系统中的profile 信息。表有Account主键是use

2、rID,它记录用户的基 本信息,如 email, name 等。Sig non 表记录者 userID 和 password, Profile 表 记录者用户的登录系统的系统设置。可以根据用户的类型,显示不同的登录信息。 (1) account 表 create table acco unt ( userid varchar(80) not nu II, email varchar(80) not nu II, n ame varchar(80) not n ull, status char(2) nu II, addr1 varchar(80) not null, addr2 varchar

3、(40) null, city varchar(80) not n ull, state varchar(80) not n ull, zip varchar(20) not n ull, country varchar(20) not n ull, phone varchar(80) not n ull, con stra int pk_acco unt primary key (userid) ) 说明:primary key是userID,它记录帐户的基本信息。 (2) Sig non 表 create table sig non ( user name varchar(25) not

4、n ull, password varchar(25) not n ull, con stra int pk_sig non primary key (user name) ) 说明:记录登录名和密码。 (3) Profile 表 create table profile ( userid varchar(80) not nu II, Ian gpref varchar(80) not nu II, favcategory varchar(30), mylistopt int, bann eropt int, con stra int pk_profile primary key (useri

5、d) ) 说明:用户的登录信息,方便个性化定制。 (4) Bannerdata 表 create table bann erdata ( favcategory varchar(80) not n ull, bannern ame varchar(255) n ull, con stra int pk_ba nn erdata primary key (favcategory) ) 说明:记录不同的登录信息。 三、产品模型 产品的模型主要有分类,它是产品的大类。表category就是记录分类名称,描 述信息。Product 对多的关系。 Item记录产品的 记录每个产品的基本信息,包括产品名称

6、,和产品的描述。它是 Supplier 表 记录产品的提供者信息,包括提供者的名称,地址,状态等。 提供者,产 品ID,价格,状态。Inventory 表记录产品的数量。关系如下: (1) category 表 create table category ( catid char(10) not null, n ame varchar(80) n ull, desc n varchar(255) n ull, con stra int pk_category primary key (catid) ) (2) product 表 create table product ( productid

7、 char(10) not n ull, category char(10) not n ull, n ame varchar(80) n ull, desc n varchar(255) n ull, con stra int pk_product primary key (productid), con stra int fk_product_1 foreig n key (category) refere nces category (catid) ) (3) item 表 create table item ( itemid char(10) not null, productid c

8、har(10) not n ull, listprice decimal(10,2) null,.unitcost decimal(10,2) null, supplier int n ull, status char(2) nu II, attrl varchar(80) null, attr2 varchar(80) null, attr3 varchar(80) nu II, attr4 varchar(80) null, attr5 varchar(80) nu II, con stra int pk_item primary key (itemid), constraint fk_i

9、tem_1 foreign key (productid) refere nces product (productid), con stra int fk_item_2 foreig n key (supplier) refere nces supplier (suppid) ) (4) inven tory 表 create table inven tory ( itemid char(10) not null, qty int not n ull ) (5) supplier 表 create table inven tory ( suppid int not n ull n ame v

10、archar(80) status char(2) attr1 varchar(80) attr2 varchar(80) city varchar(80) state varchar(80) zip char phone varchar(80) con stra int pk_supplier primary key (suppid), ) 四、定单模型 定单记录用户的选择产品信息,数量,表主要有Orders,记录用户的地址,帐户 信息,总金 额。Orderstatus 记录定单状态。Lin eitem 记录定单中的产品数量,单位价格, 产品ID。 (1) orders 表 create t

11、able orders ( orderid int not nu II, userid varchar(80) not nu II, orderdate date not n ull, shipaddr1 varchar(80) not n ull, shipaddr2 varchar(80) null, shipcity varchar(80) not nu II, shipstate varchar(80) not nu II, shipzip varchar(20) not n ull, shipco untry varchar(20) not n ull, billaddr1 varc

12、har(80) not null, billaddr2 varchar(80) null, billcity varchar(80) not null, billstate varchar(80) not null, billzip varchar(20) not null, billco untry varchar(20) not n ull, courier varchar(80) not nu II, totalprice nu mber(10,2) not nu II, billt on ame varchar(80) not n ull, shipt on ame varchar(8

13、0) not n ull, creditcard varchar(80) not n ull, exprdate char(7) not nu II, cardtype varchar(80) not n ull, locale varchar(20) not n ull, con stra int pk_orders primary key (orderid), con stra int fk_orders_1 foreig n key (userid) refere nces acco unt (userid) ) 定单的信息。 (2) Orderstatus 表 create table

14、 orderstatus ( orderid int not nu II, linenum int not n ull, timestamp date not n ull, status char(2) not nu II, con stra int pk_orderstatus primary key (orderid, li nenu m), con stra int fk_orderstatus_1 foreig n key (orderid) refere nces orders (orderid) ) 定单中的产品状态 (3) lineitem 表 create table lin eitem ( orderid int not nu II, linenum int not n ull, item

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论