easybuy数据库设计

create database easybuy /*易买网数据库*/
use easybuy
go

/*用户表,用于存放用户基本信息*/
create table easybuy_user(
eu_user_id varchar(10) not null primary key,--用户名
eu_user_name varchar(20) not null,--真实姓名
eu_password varchar(20) not null,--密码
eu_sex char(1) not null,--性别
eu_birthday date,--出生日期
eu_identity_code varchar(60),--身份证号
eu_email varchar(80),--电子邮件
eu_mobile varchar(11),--手机
eu_address varchar(200) not null,--地址
eu_staus int --类型,1普通用户,2管理员
)

insert into easybuy_user values ('10010','aaa','aaa','1','1990-01-01','500212345678945656','123465@qq.com','12345698752','重庆',1)
insert into easybuy_user values ('10011','bbb','bbb','0','1991-01-01','500212564678945656','128965@qq.com','12340123752','重庆',1)
insert into easybuy_user values ('10012','ccc','ccc','1','1992-01-01','500212345678998756','126875@qq.com','12698728752','重庆',2)
insert into easybuy_user values ('10013','ddd','ddd','1','1993-01-01','500214658978945656','123465@qq.com','12345547852','重庆',1)
insert into easybuy_user values ('10014','eee','eee','1','1994-01-01','500212345012345656','164965@qq.com','12987568752','重庆',1)
go

/*新闻表,用于存放新闻信息*/
create table easybuy_news(
en_id int not null primary key,--编号
en_title varchar(40) not null unique,--标题
en_content varchar (1000) not null,--内容
en_create_time date not null--录入日期
)
insert into easybuy_news values (20010,'降价了','1折促销','2013-01-01')
insert into easybuy_news values (20011,'打折了','2折促销','2013-01-01')
insert into easybuy_news values (20012,'抢钱了','3折促销','2013-01-01')
insert into easybuy_news values (20013,'上课了','4折促销','2013-01-01')
insert into easybuy_news values (20014,'放假了','5折促销','2013-01-01')

go

/*留言表,用于存放用户留言*/
create table easybuy_comment(
ec_id int not null primary key,--编号
ec_reply varchar(200),--留言回复
ec_content varchar(200) not null,--留言内容
ec_create_time date not null,--创建时间
ec_reply_time date,--回复时间
ec_nick_name varchar(10) not null --留言用户昵称
)

insert into easybuy_comment values (30010,'亲,这已经是最低价了','太贵了','2013-01-01','2013-01-01','欧阳锋')
insert into easybuy_comment values (30011,'亲,这已经是最低价了','太贵了','2013-01-01','2013-01-01','欧阳锋')
insert into easybuy_comment values (30012,'亲,这已经是最低价了','太贵了','2013-01-01','2013-01-01','欧阳锋')
insert into easybuy_comment values (30013,'亲,这已经是最低价了','太贵了','2013-01-01','2013-01-01','欧阳锋')
insert into easybuy_comment values (30014,'亲,这已经是最低价了','太贵了','2013-01-01','2013-01-01','欧阳锋')

 

go

/*商品表,用户存放商品基本信息*/
create table easybuy_product(
ep_id int not null primary key,--商品编号
ep_name varchar(20) not null,--商品名字
ep_description varchar(100),--商品描述
ep_price decimal(10,2) not null,--商品价格
ep_stock int not null,--商品库存
epc_id int not null,--所属分类ID
epc_child_id int ,--所属二级分类ID
ep_file_name varchar(200) not null--上传的文件名
)
go
insert into easybuy_product values (40010,'夹克','保暖',49.00,123,50010,50100,'外套')
insert into easybuy_product values (40011,'T恤','保暖',49.00,123,50011,50101,'T恤')
insert into easybuy_product values (40012,'短裤','保暖',49.00,123,50012,50102,'裤子')
insert into easybuy_product values (40013,'裙子','保暖',49.00,123,50013,50103,'裙子')
insert into easybuy_product values (40014,'板鞋','保暖',49.00,123,50014,50104,'鞋子')

go

/*商品分类表,用于存放商品的分类基本信息*/
create table easybuy_product_category(
epc_id int not null primary key,--编号
epc_name varchar(20) not null,--名字
epc_parent_id int not null--父分类
)

insert into easybuy_product_category values (50010,'服装',00010)
insert into easybuy_product_category values (50011,'服装',00010)
insert into easybuy_product_category values (50012,'服装',00010)
insert into easybuy_product_category values (50013,'服装',00010)
insert into easybuy_product_category values (50014,'鞋子',00011)


go

/*订单表,用于存放订单相关信息*/
create table easybuy_order(
eo_id int not null primary key,--编号
eo_user_id int not null,--用户ID
eo_user_name varchar(20) not null,--用户名
eo_user_address varchar(200) not null,--用户地址
eo_create_time date not null,--创建时间
eo_cost decimal(10,2) not null,--金额
eo_staus int not null,--状态,1下单 2审核通过 3配货 4送货中 5收货并确认

eo_type int not null--付款方式,1货到付款;2网上支付
)

insert into easybuy_order values (60010,10010,'aaa','重庆','2013-02-02',100.00,1,2)
insert into easybuy_order values (60011,10010,'aaa','重庆','2013-02-02',100.00,2,2)
insert into easybuy_order values (60012,10014,'eee','重庆','2013-02-02',100.00,3,2)
insert into easybuy_order values (60013,10010,'aaa','重庆','2013-02-02',100.00,4,2)
insert into easybuy_order values (60014,10010,'aaa','重庆','2013-02-02',100.00,5,1)


go

/*订单详情表,用于存放订单详细详细*/
create table easybuy_order_detail(
eod_id int not null primary key,--编号
eo_id int not null FK_product_order_detail foreign key(ep_id) references easybuy_product(ep_id),--订单ID
ep_id int not null FK_order_order_detail foreign key(eo_id) references easybuy_order(eo_id),--商品ID
eod_quantity int not null ,--数量
eod_cost decimal(10,2) not null--金额
)

insert into easybuy_order_detail values (70010,60010,40010,1,49.00)
insert into easybuy_order_detail values (70011,60010,40011,1,49.00)
insert into easybuy_order_detail values (70012,60011,40012,1,49.00)
insert into easybuy_order_detail values (70013,60013,40013,1,49.00)
insert into easybuy_order_detail values (70014,60010,40014,2,98.00)

posted on 2017-05-23 13:35  Iitb  阅读(298)  评论(0编辑  收藏  举报

导航