A. 电子商务网站怎样的数据库设计
个人建议去购买成熟的电子商务网站平台,目前已经有许多CMS系统都非常完善,功能也很齐全了,与其自己设计数据库,不如去购买现成的,如果不愿意掏钱,当然也有免费的B2B网站系统,例如SHOPEX,ECSHOP等等都是免费的。
B. 购物网站数据库表如何设计
去下载那些知名的网点系统来看看数据库设计部就可以了
C. C#,做在线商城,数据库表设计问题。
楼主的需求可以做到。
1、商品分类表(tbType)
---------------------------------------------
id(key) typeName
---------------------------------------------
0 手机
1 食物
2、额外属性表(tbAttribute)
---------------------------------------------
id(key) attributeName
---------------------------------------------
0 有效期
1 操作系统
2 配料
3、属性关联表(tbAttributeRelation)
---------------------------------------------
typeId attributeId
---------------------------------------------
0 1
1 0
1 2
4、商品表(tbGoods)
---------------------------------------------
id(key) type name price 共同字段……
---------------------------------------------
0 0 NOKIA 2000 ……
1 1 A牌肉包 30 ……
2 1 B牌菜包 10 ……
5、属性详细表(tbDetail)
---------------------------------------------
id(key) attributeId(key) value
---------------------------------------------
0 1 塞班S60V3
1 0 3天
1 2 面粉,精肉
2 0 4天
2 2 面粉,青菜
这样就可以了。谢谢采纳。
如果需要增加一个属性,在 2、额外属性表(tbAttribute)增加一条记录 和 3、属性关联表(tbAttributeRelation)里增加一条关联。然后就可以去 5、属性详细表(tbDetail)里存储这个属性的值。例如我要为手机增加一个续航能力的属性。
只需要
2、额外属性表(tbAttribute)
---------------------------------------------
id(key) attributeName
---------------------------------------------
0 有效期
1 操作系统
2 配料
3 续航能力 《---新增的
3、属性关联表(tbAttributeRelation)
---------------------------------------------
typeId attributeId
---------------------------------------------
0 1
1 0
1 2
0 3 《---新增的
5、属性详细表(tbDetail)
---------------------------------------------
id(key) attributeId(key) value
---------------------------------------------
0 1 塞班S60V3
1 0 3天
1 2 面粉,精肉
2 0 4天
2 2 面粉,青菜
0 3 900小时 《---新增的
这样的设计看起来麻烦。但其实并不麻烦。
不仅能够动态增加任意的分类和分类的任意独特属性。
还可以让不同分类之间相同的属性复用。达到数据库的最小耦合。
D. 购物网站数据库设计
一、概述
网上购物店的数据模型,主要模式有产品:proct ,帐户:Account,定单:Order。和产品相关的表有category ,proct,item, inventory, supplier;和用户相关表有的account ,signon,profile;和定单相关的表有orders,orderstatus,lineitem ,整体关系如下.
二、帐户模型
帐户模型,记录者用户的登录名称,密码。以及个人信息如地址,性名,电话等,还有它在系统中的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 就是记录分类名称,描述信息。Proct
记录每个产品的基本信息,包括产品名称,和产品的描述。它是一对多的关系。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)proct表
create table proct (
proctid char(10) not null,
category char(10) not null,
name varchar(80) null,
descn varchar(255) null,
constraint pk_proct primary key (proctid),
constraint fk_proct_1 foreign key (category)
references category (catid)
)
(3) item表
create table item (
itemid char(10) not null,
proctid 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 (proctid)
references proct (proctid),
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)
)
E. 关于购物网站的数据库设计问题
不要这样,这样你会有无数多的表,而且以后新的一个产品时候非常麻烦,如果要属于新的类别,而且还会因为避免数据库太复杂而使得许多不同类的产品归在一个类。而且你的程序很麻烦,要为每个类编写不同程序,因为数据表名不同。
应该用下面的办法,主要使用四个表存储所有类别的商品:
第一、类别名称表,字段有
类别ID,类别名称
1 电脑
2 洗衣机
第二、类别属性表,字段有:
类别ID,属性ID,属性名称
1 1 CPU
1 2 内存
1 3 屏幕尺寸
2 1 容量
2 2 类型
第三、商品名称表,字段有:
商品ID,类别ID
1 1
2 1
3 2
4 2
第四、商品属性表,字段有:
商品ID,属性ID,属性值
1 1 P4
1 2 128M
1 3 CRT 14
2 1 P4
2 2 512M
2 3 LCD19
3 1 9公斤
3 2 滚筒
4 1 8公斤
4 2 波轮
上面定义了四个商品,商品ID为1~4,分别是128M、512M内存的电脑,和9公斤滚筒、8公斤的波轮洗衣机。
这样定义的数据库结构,可以包含任何商品,一般不会改变,那么程序也就无需改变,定义新的产品、或者修改现有商品只需要在程序界面有操作员点点鼠标。
F. 电商项目---数据库表设计
CREATE TABLE `mmall_user` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户表id',
`username` varchar(50) NOT NULL COMMENT '用户名',
`password` varchar(50) NOT NULL COMMENT '用户密码,MD5加密',
`email` varchar(50) DEFAULT NULL,
`phone` varchar(20) DEFAULT NULL,
`question` varchar(100) DEFAULT NULL COMMENT '找回密码问题',
`answer` varchar(100) DEFAULT NULL COMMENT '找回密码答案',
`role` int(4) NOT NULL COMMENT '角色0-管理员,1-普通用户',
`create_time` datetime NOT NULL COMMENT '创建时间',
`update_time` datetime NOT NULL COMMENT '最后一次更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `user_name_unique` (`username`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_proct` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '商品id',
`category_id` int(11) NOT NULL COMMENT '分类id,对应mmall_category表的主键',
`name` varchar(100) NOT NULL COMMENT '商品名称',
`subtitle` varchar(200) DEFAULT NULL COMMENT '商品副标题',
`main_image` varchar(500) DEFAULT NULL COMMENT '产品主图,url相对地址',
`sub_images` text COMMENT '图片地址,json格式,扩展用',
`detail` text COMMENT '商品详情',
`price` decimal(20,2) NOT NULL COMMENT '价格,单位-元保留两位小数',
`stock` int(11) NOT NULL COMMENT '库存数量',
`status` int(6) DEFAULT '1' COMMENT '商品状态.1-在售 2-下架 3-删除',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_category` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '类别Id',
`parent_id` int(11) DEFAULT NULL COMMENT '父类别id当id=0时说明是根节点,一级类别',
`name` varchar(50) DEFAULT NULL COMMENT '类别名称',
`status` tinyint(1) DEFAULT '1' COMMENT '类别状态1-正常,2-已废弃',
`sort_order` int(4) DEFAULT NULL COMMENT '排序编号,同类展示顺序,数值相等则自然排序',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=100031 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_order` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单id',
`order_no` bigint(20) DEFAULT NULL COMMENT '订单号',
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`shipping_id` int(11) DEFAULT NULL,
`payment` decimal(20,2) DEFAULT NULL COMMENT '实际付款金额,单位是元,保留两位小数',
`payment_type` int(4) DEFAULT NULL COMMENT '支付类型,1-在线支付',
`postage` int(10) DEFAULT NULL COMMENT '运费,单位是元',
`status` int(10) DEFAULT NULL COMMENT '订单状态:0-已取消-10-未付款,20-已付款,40-已发货,50-交易成功,60-交易关闭',
`payment_time` datetime DEFAULT NULL COMMENT '支付时间',
`send_time` datetime DEFAULT NULL COMMENT '发货时间',
`end_time` datetime DEFAULT NULL COMMENT '交易完成时间',
`close_time` datetime DEFAULT NULL COMMENT '交易关闭时间',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
UNIQUE KEY `order_no_index` (`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=118 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_order_item` (
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '订单子表id',
`user_id` int(11) DEFAULT NULL,
`order_no` bigint(20) DEFAULT NULL,
`proct_id` int(11) DEFAULT NULL COMMENT '商品id',
`proct_name` varchar(100) DEFAULT NULL COMMENT '商品名称',
`proct_image` varchar(500) DEFAULT NULL COMMENT '商品图片地址',
`current_unit_price` decimal(20,2) DEFAULT NULL COMMENT '生成订单时的商品单价,单位是元,保留两位小数',
`quantity` int(10) DEFAULT NULL COMMENT '商品数量',
`total_price` decimal(20,2) DEFAULT NULL COMMENT '商品总价,单位是元,保留两位小数',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`),
KEY `order_no_index` (`order_no`) USING BTREE,
KEY `order_no_user_id_index` (`user_id`,`order_no`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=135 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_cart` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) NOT NULL,
`proct_id` int(11) DEFAULT NULL COMMENT '商品id',
`quantity` int(11) DEFAULT NULL COMMENT '数量',
`checked` int(11) DEFAULT NULL COMMENT '是否选择,1=已勾选,0=未勾选',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`),
KEY `user_id_index` (`user_id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=127 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_pay_info` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`order_no` bigint(20) DEFAULT NULL COMMENT '订单号',
`pay_platform` int(10) DEFAULT NULL COMMENT '支付平台:1-支付宝,2-微信',
`platform_number` varchar(200) DEFAULT NULL COMMENT '支付宝支付流水号',
`platform_status` varchar(20) DEFAULT NULL COMMENT '支付宝支付状态',
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=61 DEFAULT CHARSET=utf8;
CREATE TABLE `mmall_shipping` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`user_id` int(11) DEFAULT NULL COMMENT '用户id',
`receiver_name` varchar(20) DEFAULT NULL COMMENT '收货姓名',
`receiver_phone` varchar(20) DEFAULT NULL COMMENT '收货固定电话',
`receiver_mobile` varchar(20) DEFAULT NULL COMMENT '收货移动电话',
`receiver_province` varchar(20) DEFAULT NULL COMMENT '省份',
`receiver_city` varchar(20) DEFAULT NULL COMMENT '城市',
`receiver_district` varchar(20) DEFAULT NULL COMMENT '区/县',
`receiver_address` varchar(200) DEFAULT NULL COMMENT '详细地址',
`receiver_zip` varchar(6) DEFAULT NULL COMMENT '邮编',
`create_time` datetime DEFAULT NULL,
`update_time` datetime DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=30 DEFAULT CHARSET=utf8;
GitHub 地址:https://github.com/Andy-leoo/NewBieJavaPro.git
G. 购物网站数据库设计
一、概述
网上购物店的数据模型,主要模式有产品:proct ,帐户:Account,定单:Order。和产品相关的表有category ,proct,item, inventory, supplier;和用户相关表有的account ,signon,profile;和定单相关的表有orders,orderstatus,lineitem ,整体关系如下.
二、帐户模型
帐户模型,记录者用户的登录名称,密码。以及个人信息如地址,性名,电话等,还有它在系统中的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 就是记录分类名称,描述信息。Proct
记录每个产品的基本信息,包括产品名称,和产品的描述。它是一对多的关系。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)proct表
create table proct (
proctid char(10) not null,
category char(10) not null,
name varchar(80) null,
descn varchar(255) null,
constraint pk_proct primary key (proctid),
constraint fk_proct_1 foreign key (category)
references category (catid)
)
(3) item表
create table item (
itemid char(10) not null,
proctid 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 (proctid)
references proct (proctid),
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)
)
H. 多用户商城数据库如何设计
差不多都是一个 文章表,用户表,分类表,设置表。
1、数据库分离成前台和后台,通过链接表关联;
2、把前台做成弹出窗体,禁止用户使用导航选项和菜单之类;
3、把前台编译成ACCESS2007的accde文件(对应ACCESS2003的mde文件);
4、把这个accde文件也放在服务器端,客户端通过winform之类exe来远程打开。
前3步都比较正常,第4步的看起来应该比较奇怪。我的想法是,如果accde文件也放在客户端,高手会不会通过反编译就可以进入到数据库看到链接表?感觉上“禁止Shift”,“隐藏表”这类手段只对菜鸟有用。