网上购物车数据库设计

上传人:飞*** 文档编号:32597584 上传时间:2018-02-11 格式:DOCX 页数:6 大小:17.62KB
返回 下载 相关 举报
网上购物车数据库设计_第1页
第1页 / 共6页
网上购物车数据库设计_第2页
第2页 / 共6页
网上购物车数据库设计_第3页
第3页 / 共6页
网上购物车数据库设计_第4页
第4页 / 共6页
网上购物车数据库设计_第5页
第5页 / 共6页
点击查看更多>>
资源描述

《网上购物车数据库设计》由会员分享,可在线阅读,更多相关《网上购物车数据库设计(6页珍藏版)》请在金锄头文库上搜索。

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

2、userID,它记录用户的基本信息,如 email,name 等。Signon 表记录者 userID 和 password,Profile 表记录者用户的登录系统的系统设置。可以根据用户的类型,显示不同的登录信息。(1)account 表create table account (userid varchar(80) not null,email varchar(80) not null,name varchar(80) not null,status char(2) null,addr1 varchar(80) not null,addr2 varchar(40) null,city va

3、rchar(80) not null,state varchar(80) not null,zip varchar(20) not null,country varchar(20) not null,phone varchar(80) not null,constraint pk_account primary key (userid)说明:primary key 是 userID,它记录帐户的基本信息。(2)Signon 表create table signon (2 网上购物车数据库设计username varchar(25) not null,password varchar(25) n

4、ot null,constraint pk_signon primary key (username)说明:记录登录名和密码。(3)Profile 表create table profile (userid varchar(80) not null,langpref varchar(80) not null,favcategory varchar(30),mylistopt int,banneropt int,constraint pk_profile primary key (userid)说明:用户的登录信息,方便个性化定制。(4)Bannerdata 表create table bann

5、erdata (favcategory varchar(80) not null,bannername varchar(255) null,constraint pk_bannerdata primary key (favcategory)说明:记录不同的登录信息。三、产品模型产品的模型主要有分类,它是产品的大类。表 category 就是记录分类名称,描述信息。Product记录每个产品的基本信息,包括产品名称,和产品的描述。它是一对多的关系。Supplier 表记录产品的提供者信息,包括提供者的名称,地址,状态等。Item 记录产品的提供者,产品 ID,价格,状态。Inventory 表记

6、录产品的数量。关系如下:3 网上购物车数据库设计(1) category 表create table category (catid char(10) not null,name varchar(80) null,descn varchar(255) null,constraint pk_category primary key (catid)(2)product 表create table product (productid char(10) not null,category char(10) not null,name varchar(80) null,descn varchar(25

7、5) null,constraint pk_product primary key (productid),constraint fk_product_1 foreign key (category)references category (catid)(3) item 表create table item (itemid char(10) not null,productid char(10) not null,listprice decimal(10,2) null,.unitcost decimal(10,2) null,supplier int null,status char(2)

8、null,attr1 varchar(80) null,attr2 varchar(80) null,attr3 varchar(80) null,attr4 varchar(80) null,attr5 varchar(80) null,constraint pk_item primary key (itemid),4 网上购物车数据库设计constraint fk_item_1 foreign key (productid)references product (productid),constraint fk_item_2 foreign key (supplier)references

9、 supplier (suppid)(4) inventory 表create table inventory (itemid char(10) not null,qty int not null)(5)supplier 表create table inventory (suppid int not nullname varchar(80) status char(2) attr1 varchar(80)attr2 varchar(80)city varchar(80)state varchar(80)zip char(6)phone varchar(80)constraint pk_supp

10、lier primary key (suppid),)四、定单模型定单记录用户的选择产品信息,数量,表主要有 Orders,记录用户的地址,帐户信息,总金额。Orderstatus 记录定单状态。Lineitem 记录定单中的产品数量,单位价格,产品 ID。(1)orders 表create table orders (orderid int not null,userid varchar(80) not null,5 网上购物车数据库设计orderdate date not null,shipaddr1 varchar(80) not null,shipaddr2 varchar(80) n

11、ull,shipcity varchar(80) not null,shipstate varchar(80) not null,shipzip varchar(20) not null,shipcountry varchar(20) not null,billaddr1 varchar(80) not null,billaddr2 varchar(80) null,billcity varchar(80) not null,billstate varchar(80) not null,billzip varchar(20) not null,billcountry varchar(20) n

12、ot null,courier varchar(80) not null,totalprice number(10,2) not null,billtoname varchar(80) not null,shiptoname varchar(80) not null,creditcard varchar(80) not null,exprdate char(7) not null,cardtype varchar(80) not null,locale varchar(20) not null,constraint pk_orders primary key (orderid),constra

13、int fk_orders_1 foreign key (userid)references account (userid)定单的信息。(2)Orderstatus 表create table orderstatus (orderid int not null,linenum int not null,6 网上购物车数据库设计timestamp date not null,status char(2) not null,constraint pk_orderstatus primary key (orderid, linenum),constraint fk_orderstatus_1 fo

14、reign key (orderid)references orders (orderid)定单中的产品状态(3)lineitem 表create table lineitem (orderid int not null,linenum int not null,itemid char(10) not null,quantity int not null,unitprice number(10,2) not null,constraint pk_lineitem primary key (orderid, linenum),constraint fk_lineitem_1 foreign key (orderid)references orders (orderid)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 活动策划

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号