网上购物车数据库设计

摘要:
以及个人信息,如地址、性别姓名、电话等,以及系统中的个人资料信息。Signon表记录用户ID和密码,Profile表记录用户登录系统的系统设置。可以根据用户类型显示不同的登录信息。登录表createtablesignon描述:记录登录名和密码。Bannerdata表createtablebannerdata描述:记录不同的登录信息。产品记录每个产品的基本信息,包括产品名称和产品描述。Orderstatus记录订单状态。行项目记录订单中的产品数量、单价和产品ID。

一、概述

网上购物店的数据模型,它主要模式有产品:product ,帐户:Account,定单:Order。和产品相关的表有category ,product,item, inventory, supplier;和用户相关表有的account ,signon ,profile;和定单相关的表有orders,orderstatus,lineitem

FK:Foreign Key

二、帐户模型

帐户模型,记录者用户的登录名称,密码。以及个人信息如地址,性名,电话等,还有它在系统中的profile信息。表有Account 主键是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 varchar(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 (

username varchar(25) not null,

password varchar(25) not 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 bannerdata (

favcategory varchar(80) not null,

bannername varchar(255) null,

constraint pk_bannerdata primary key (favcategory)

)

说明:记录不同的登录信息。

三、产品模型

产品的模型主要有分类,它是产品的大类。表category 就是记录分类名称,描述信息。Product

记录每个产品的基本信息,包括产品名称,和产品的描述。它是一对多的关系。Supplier 表

记录产品的提供者信息,包括提供者的名称,地址,状态等。Item 记录产品的提供者,产

品ID,价格,状态。Inventory 表记录产品的数量。关系如下:

(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(255) 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) 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),

constraint fk_item_1 foreign key (productid)

references product (productid),

constraint fk_item_2 foreign key (supplier)

references supplier (suppid)

)

(4) inventory 表

create table inventory (

itemid char(10) not null,

qty int not null

)

(5)supplier表

create table inventory (

suppid int not null

name 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_supplier primary key (suppid),

)

四、定单模型

定单记录用户的选择产品信息,数量,表主要有Orders,记录用户的地址,帐户信息,总金

额。Orderstatus 记录定单状态。Lineitem 记录定单中的产品数量,单位价格,产品ID。

(1)orders表

create table orders (

orderid int not null,

userid varchar(80) not null,

orderdate date not null,

shipaddr1 varchar(80) not null,

shipaddr2 varchar(80) null,

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) not 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),

constraint fk_orders_1 foreign key (userid)

references account (userid)

)

定单的信息。

(2)Orderstatus表

create table orderstatus (

orderid int not null,

linenum int not null,

timestamp date not null,

status char(2) not null,

constraint pk_orderstatus primary key (orderid, linenum),

constraint fk_orderstatus_1 foreign 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)

)

免责声明:文章转载自《网上购物车数据库设计》仅用于学习参考。如对内容有疑问,请及时联系本站处理。

上篇Java使用Robot操作键盘和鼠标云小课|DGC数据开发之基础入门篇下篇

宿迁高防,2C2G15M,22元/月;香港BGP,2C5G5M,25元/月 雨云优惠码:MjYwNzM=

相关文章

XML文件的解析--libxml库函数解释

[c语言]XML文件的解析--libxml库函数解释 2009-09-02 13:12 XML文件的解析--libxml库函数解释 libxml(一)                                     摘要 Libxml是一个有免费许可的用于处理XML、可以轻松跨越多个平台的C语言库。这个指南提供它的基本函数的例子。绪论 Lib...

Oracle10g 表分区

1.分区的原因 (1)Tables greater than 2GB should always be considered for partitioning. (2)Tables containing historical data, in which new data is added into the newest partition. A typi...

(转载)Telnet协议详解及使用C# 用Socket 编程来实现Telnet协议

转自:http://www.cnblogs.com/jicheng1014/archive/2010/01/28/1658793.html 这因为有个任务涉及到使用telnet 来连接远端的路由器,获取信息,之后进行处理. 所以需要写一个自动telnet登录到远端,之后获取信息进行处理的程序. 自己C++ 一塌糊涂,所以几乎最开始就没打算用C++或者C写...

element table显示滚动条

1 /* .tableX为要显示滚动条的类名 */ 2 /* 显示横向滚动条 */ 3 .tableX .el-table--scrollable-x .el-table__body-wrapper { 4 padding: 0 0 5px 0; 5 margin: 0 0 5px 0; 6 overflow-x: auto; 7...

mysql表碎片清理和表空间收缩

一、表碎片清理 存储结构分析 MySQL5.5默认是共享表空间 ,5.6中默认是独立表空间(表空间管理类型就这2种) 独立表空间 就是采用和MyISAM 相同的方式, 每个表拥有一个独立的数据文件( .idb )1.每个表都有自已独立的表空间。 2.每个表的数据和索引都会存在自已的表空间中。 3.可以实现单表在不同的数据库中移动(将一个库的表移动到另一个库...

《QT Creator快速入门》第十一章(一):图形视图

一、图形视图框架结构 图形视图框架由场景QGraphicsScene、视图QGraphicsView、图形项QGraphicsItem组成,它提供了一套基于图形项模型视图编程方法。图形视图框架可以管理数量庞大的自定义2D图形项,比如要绘制上万个图形并对这些图形进行拖动、检测位置等操作的话使用图形视图框架就可以方便的管理它们。场景中可以包含各种形状的图形项,...