网上商城项目数据库表
MySQL数据库技术与项目应用 项目四 查询网上商城系统数据

选择行
• 使用LIKE运算符
• 实际中当需要查询的条件只能提供部分信息时,就需要使用LIKE运算符实现字符串 的模糊查询。
WHERE 列名 [NOT] LIKE ‘字符串常量’ [ESCAPE ‘转义字符’]
目录/Contents
01
查询单表数据
02
排序和分组统计单表数据
03
查询多表数据
04
子查询多表数据
任务1 查询单表数据
任务场景
单表数据查询是最基本的数据查询,其查询的数据源只涉及数据库中的 一张表。本任务详细介绍SELECT命令基本语法,以实现在数据表中查 询数据列、数据行、限制返回结果数及更改查询结果等操作。
选择行
• 使用IN运算符
• IN运算符与BETWEEN…AND运算符类似,用来限制查询数据的范围。
WHERE 表达式 [NOT] IN (值1,值2,…,值N)
【例4.15】查询goods表, 找出类别ID(cid)为1、2、5的商品,列出类别ID 和名称。
SELECT cid, gname FROM goods WHERE cid IN (1, 2, 4) ;
选择行
• 使用BETWEEN AND运算符
• WHERE子句中,可使用BETWEEN AND来限制查询数据的范围
WHERE 表达式 [NOT] BETWEEN 初始值 AND 终止值
• 【例4.14】查询goods表,找出价格在200到400元的商品名称和价格。
SELECT gname, gprice FROM goods WHERE gprice BETWEEN 200 AND 400 ;
(完整版)网上商城项目数据库表

网上商城项目数据库表*****************************************************' 添加商品记录同步添加库存记录的触发器'*****************************************************IF EXISTS (SELECT name FROM sysobjects WHERE name = 'AddGoodsInfo' AND type = 'TR') DROP TRIGGER AddGoodsInfoGOCREATE TRIGGER AddGoodsInfo ON [dbo].[GoodsInfo]FOR INSERTASINSERT INTO GoodsSave select GoodsID,GoodsName,0,0,getdate(),getdate() from insertedGO' 删除商品记录同步删除库存记录的触发器'*****************************************************IF EXISTS (SELECT name FROM sysobjects WHERE name = 'DelGoodsInfo' AND type = 'TR') DROP TRIGGER DelGoodsInfoGOCREATE TRIGGER DelGoodsInfo ON [dbo].[GoodsInfo]FOR DELETEASDELETE from GoodsSave where GoodsID = (SELECT GoodsID FROM deleted)GO'*****************************************************' 重新同步商品在库存表中的对应记录的存储过程'*****************************************************CREATE PROCEDURE BindGoodsToSave ASIF EXISTS (SELECT name FROM sysobjects WHERE name = 'GoodsSave' AND type = 'U') BEGINDROP TABLE GoodsSavecreate table GoodsSave (GoodsSaveID integer identity,GoodsID integer null,GoodsName nvarchar(100) null,SaveNum integer null default 0,SaveAddNum integer null default 0,SaveTime datetime null default getdate(),SaveAddTime datetime null default getdate(),constraint PK_GOODSSAVE primary key (GoodsSaveID))ENDELSEBEGINcreate table GoodsSave (GoodsSaveID integer identity,GoodsID integer null,GoodsName nvarchar(100) null,SaveNum integer null default 0,SaveAddNum integer null default 0,SaveTime datetime null default getdate(),SaveAddTime datetime null default getdate(),constraint PK_GOODSSAVE primary key (GoodsSaveID))ENDINSERT INTO GoodsSave(GoodsID,GoodsName) select GoodsID,GoodsName from GoodsInfo order by GoodsID'*****************************************************' 按日期和月份统计注册人数的存储过程'*****************************************************CREATE procedure GetRegUsers@id intASdeclare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录IDdeclare @tempRegDate nvarchar(10) --临时表日期set nocount onif (@id = 0)begininsert into @table(RegDate)select distinct convert(char(10),UserCreateTime,120) from Users order by convert(char(10),UserCreateTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from Users whereconvert(char(10),UserCreateTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendelsebegininsert into @table(RegDate)select distinct convert(char(7),UserCreateTime,120) from Users order by convert(char(7),UserCreateTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from Users whereconvert(char(7),UserCreateTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorset nocount offselect * from @table where RegDate is not nullGO'*****************************************************' 按日期和月份统计用户订单的存储过程'*****************************************************CREATE procedure GetUserOrders@id intASdeclare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录IDdeclare @tempRegDate nvarchar(10) --临时表日期set nocount onif (@id = 0)begininsert into @table(RegDate)select distinct convert(char(10),OrderTime,120) from GoodsOrder order by convert(char(10),OrderTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(10),OrderTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendbegininsert into @table(RegDate)select distinct convert(char(7),OrderTime,120) from GoodsOrder order by convert(char(7),OrderTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(7),OrderTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendset nocount offselect * from @table where RegDate is not nullGO。
网上图书商城数据库设计

《在线图书商城》-- 数据库设计2016。
6.5数据库在在一个信息管理系统中占有非常重要的地位,数据库结构设计的好坏将直接对应用系统的效率以及实现的效果产生影响。
数据库设计一般包括以下四个部分:数据库需求分析、数据库概念结构设计、数据库逻辑结构设计、数据库物理结构实现。
一、数据库需求分析系统主要分为两部分,一个为普通会员用户部分,亦即前台系统.另外一个是系统的管理员部分,即后台系统。
网上书店前台系统部分主要是实现网上选书、购书、产生订单等功能的系统。
后台实现书籍管理、用户管理、订单处理等功能。
开发工具:Microsoft SQLServer 2000开发语言:SQL二、数据库概念结构设计系统共有九个实体:客户、管理员、图书类型、图书、订单、详细订单、参数设置、图书评价、信息反馈。
(1)客户(会员)的属性:自动编号CustomerId、客户名、客户密码、真实姓名、性别、客户电话、E—mail、地址、注册时间、提示问题、问题答案、登陆次数、最近登陆时间、邮编(2)管理员的属性:自动编号AdminId、管理员名称、管理员邮箱、密码、权限标志(3)图书类型的属性:自动编号BookTypeId、类别名称(4)图书的属性:自动编号BookId、图书名称、图书类型、出版社、出版日期、开本、版次、图书作者、图书译者、图书ISBN、图书定价、图书页码、图书简介、图书目录、市场价、会员价、成交量、浏览次数、折扣、图书封面图、图书库存量、入库时间、封装方式2.图书信息3。
管理员信息4.客户信息5。
订单信息6.图书评论信三、据库逻辑结构设计 & 数据库物理结构实现1.客户(会员):问题,问题答案,登陆次数,最近登陆时间,邮编)表1:客户信息表tb_customerinfo代码实现:tb_customerinfocreate table tb_customerinfo (CustomerId int identity,CustomerName varchar(20) not null,CustomerPwd varchar(20) not null,Customertruename varchar(20) not null,CustomerSex varchar(2) not nullconstraint CKC_CUSTOMERSEX_TB_CUSTO check (CustomerSex in ('男’,'女')),CustomerTel varchar(20) not null,CustomerEmail varchar(20) not null,CustomerAddr varchar(20) not null,CustomerRegTime datetime not null,CustomerQues varchar(200) null,CustomerAnswer varchar(200) null,CustomerLogTime int not null,CustomerLastLogT datetime not null,constraint PK_TB_CUSTOMERINFO primary key(CustomerId, CustomerName)2.管理员:表2:管理员信息表tb_manager代码实现:tb_managercreate table tb_manager (AdminId int identity, AdminName varchar(10) not null, AdminPwd varchar(20) not null, AdminFlag int not null, constraint PK_TB_MANAGER primary key (AdminId))3.图书类型表3:图书类型信息表tb_booktypeinfo代码实现:tb_booktypeinfocreate table tb_booktypeinfo (BookTypeId int identity, BookTypeName varchar(50) not null,constraint PK_TB_BOOKTYPEINFO primary key (BookTypeId))4.图书ISBN,图书定价,图书页码,图书简介,图书目录,市场价,会员价,成交量,浏览次数,折扣,图书封面图,图书库存量,入库时间、封装方式)表4:图书信息表tb_bookinfo代码实现:tb_bookinfocreate table tb_bookinfo (BookId int identity, BookTypeId int not null,BookName varchar(20) not null, BookType varchar(10) not null, BookPress varchar(20) not null, BookPubDate datetime not null,BookSize varbinary(10) not null,BookVersion varchar(10) not null,BookAuthor varchar(10) not null, BookTanslor varchar(10) null,Bookisbn varchar(20) not null, BookPrice money not null,BookPages int not null, BookOutline varchar(200) not null, BookCatalog varchar(200) not null,BookMprice money not null, BookPrprice money not null,BookDealmount int not null,BookLookmount int null,BookDiscount varchar(10) not null, BookPic money not null, BookStoremount int not null,BookStoretime datetime not null, BookPackstyle varchar(20) not null, constraint PK_TB_BOOKINFO primary key (BookId))5.购物车临时订购信息表5:购物车临时订购信息tb_shopbook代码实现:tb_shopbookcreate table tb_shopbook (CustomerId int not null,BookId int not null,ordermount int not null,price money not null,ispay varchar(10) not null default ’未付款’constraint CKC_ISPAY_TB_SHOPB check (ispay in ('未付款',’已付款')), constraint PK_TB_SHOPBOOK primary key (CustomerId, BookId))6.订单收货地址,收货人联系方式,备注,总卖出价)表6:订单信息表tb_order代码实现:table tb_ordercreate table tb_order (Id int identity, OrderId varchar(20) not null, CustomerId int not null,Orderdate datetime not null, Ordermount int not null, message varchar(100) null,postmethod varchar(100) not null, paymethod varchar(100) not null, recevername varchar(10) not null, receveraddr varchar(20) not null, recevertel varchar(10) not null, memo varchar(100) null,totalprice money not null,constraint PK_TB_ORDER primary key (OrderId))7.详细订单表7:订单详细信息表tb_orderdetail代码实现:tb_orderdetailcreate table tb_orderdetail (id int identity,OrderDetailId varchar(20) not null,OrderId varchar(20) not null,BookId int not null,ordermount int not null,poststatus varchar(10) not null default ’未发货'constraint CKC_POSTSTATUS_TB_ORDER check (poststatus in (’未发货’,'已发货’)), Recevstatus varchar(10) not null default '未收货'constraint CKC_RECEVSTATUS_TB_ORDER check (Recevstatus in ('未收货’,’已收货’)),sigletotalprice money not null,constraint PK_TB_ORDERDETAIL primary key (OrderDetailId))8.图书评价表8:图书评价信息表tb_comment代码实现:tb_commentcreate table tb_comment (CommentId int not null,BookId int not null, CustomerId int not null, Customername varchar(20) not null, Commentdate datetime not null, Commentcontent varchar(100) not null, Commentflag varchar(10) not null, constraint PK_TB_COMMENT primary key (CommentId))9.信息反馈客户IP)表9:信息反馈信息表tb_reply代码实现:tb_replycreate table tb_reply (ReplyId int not null, CustomerId int not null, ReplyType varchar(20) not null, Replytitle varchar(20) not null, Replycontent varchar(100) not null, Customername varchar(20) not null, Commentdate datetime not null, CustomerIP varchar(10) not null, constraint PK_TB_REPLY primary key (ReplyId))10.参数设置信息代码实现:table tb_parametertb_ create table tb_parameter (webname varchar(20) not null,regtiaoyue varchar(100) not null, notice varchar(100) not null,address varchar(20) not null,postcode varchar(10) not null, tel varchar(10) not null, copyright varchar(20) not null, weblogo varchar(100) not null, website varchar(10) not null, affordmethod varchar(100) not null, shopstream varchar(100) not null, postmethod varchar(100) not null, postprice money not null, Postdescp varchar(100) not null, worktime varchar(20) not null,service varchar(100) not null, law varchar(100) not null, commques varchar(100) not null, dealrule varchar(100) not null, constraint PK_TB_PARAMETER primary key (webname))。
人人商城数据库结构

人人商城数据库结构表名功能ims_ewei_shop_adv 广告表ims_ewei_shop_alipaym_log *支付宝直接充值日志表ims_ewei_shop_article 营销文章ims_ewei_shop_article_category 营销表单分类ims_ewei_shop_article_log 点赞/阅读记录ims_ewei_shop_article_report 用户举报记录ims_ewei_shop_article_share 用户分享数据ims_ewei_shop_article_sys 文章设置ims_ewei_shop_carrier 自提点表ims_ewei_shop_category 商品分类表ims_ewei_shop_commission_apply 提现申请表ims_ewei_shop_commission_clickcount 点击记数表ims_ewei_shop_commission_level 分销分级表ims_ewei_shop_commission_log 分销日志表ims_ewei_shop_commission_shop 店中店表ims_ewei_shop_coupon 优惠券表ims_ewei_shop_coupon_category 优惠券分类表ims_ewei_shop_coupon_data 优惠券领取记录表ims_ewei_shop_coupon_guess 优惠券口令玩法日志表ims_ewei_shop_coupon_log 优惠券日志表ims_ewei_shop_creditshop_adv 积分商城广告表ims_ewei_shop_creditshop_category 积分商城分类表ims_ewei_shop_creditshop_goods 积分商城商品表ims_ewei_shop_creditshop_log 积分商城日志表ims_ewei_shop_designer 店铺装修插件表ims_ewei_shop_designer_menu 店铺装修菜单表ims_ewei_shop_dispatch 配送表ims_ewei_shop_diyform_category 自定义表单分类表ims_ewei_shop_diyform_data 自定义表单数据表ims_ewei_shop_diyform_temp 自定义表单临时表ims_ewei_shop_diyform_type 自定义表单类型*ims_ewei_shop_erp_area ERP插件地区表*ims_ewei_shop_erp_product ERP插件产品表ims_ewei_shop_exhelper_express 快递助手打印模板表ims_ewei_shop_exhelper_senduser 快递助手发货人信息表ims_ewei_shop_exhelper_sys 快递助手打印机配置表ims_ewei_shop_express 物流表ims_ewei_shop_feedback 反馈表ims_ewei_shop_goods 商品表*ERP *全球购*甩手掌柜ims_ewei_shop_goods_comment 商品评论表ims_ewei_shop_goods_option 商品规格表*ERPims_ewei_shop_goods_param 商品参数表ims_ewei_shop_goods_spec 商品规格表ims_ewei_shop_goods_spec_item 商品规格项目表*ims_ewei_shop_member 用户表*注册表单*启动画面*关注、佣金排行版ims_ewei_shop_member_address 用户地址表ims_ewei_shop_member_cart 用户购物车表ims_ewei_shop_member_favorite 用户收藏表ims_ewei_shop_member_group 用户组表ims_ewei_shop_member_history 用户浏览足迹表ims_ewei_shop_member_level 用户分级表ims_ewei_shop_member_log 用户充值记录表ims_ewei_shop_member_message_template 模板消息表ims_ewei_shop_notice 提醒表ims_ewei_shop_order 订单表*ERPims_ewei_shop_order_comment 订单评论表ims_ewei_shop_order_goods 订单商品表ims_ewei_shop_order_refund 订单退货表ims_ewei_shop_perm_log 权限日志ims_ewei_shop_perm_plugin 插件权限ims_ewei_shop_perm_role 权限规则ims_ewei_shop_perm_user 用户权限ims_ewei_shop_plugin 插件表ims_ewei_shop_postera 活动海报表ims_ewei_shop_postera_log 活动海报日志表ims_ewei_shop_postera_qr 活动海报二维码表ims_ewei_shop_poster 超级海报表ims_ewei_shop_poster_log 超级海报日志表ims_ewei_shop_poster_qr 超级海报二维码表ims_ewei_shop_poster_scan 超级海报扫描表*ims_ewei_shop_regform 注册表单审核表ims_ewei_shop_refund_address 退货地址表ims_ewei_shop_saler 核销人员表ims_ewei_shop_store 商店表ims_ewei_shop_sysset 系统设置ims_ewei_shop_system_copyright 版权设置ims_ewei_shop_virtual_category 虚拟商品分类ims_ewei_shop_virtual_data 虚拟商品数据ims_ewei_shop_virtual_type 虚拟商品类型。
网上商城设计(数据库设计-UML建模)

网上商城设计目录1 系统分析与设计 (2)1.1系统总体的功能需求 (2)1.2用户接口模块 (3)1.3管理员接口模块 (4)2 系统UML建模 (6)2.1系统用例图 (6)2.2系统的时序图和活动图 (9)3 数据库设计 (11)3.1数据库的R-R图 (11)3.2数据表设计 (12)1 系统分析与设计1.1系统总体的功能需求网上商城是个复杂的电子商务系统,它必须提供接口以供用户登陆并从中选购喜爱的商品,同时还提供系统的管理接口以供管理员和一般网站工作者处理客户订单并维护网站正常运行。
系统的总体功能框架如图1所示:图1 系统总体功能需求图(1)用户接口模块。
用户接口是网站用户使用商城系统的服务入口,所有在线用户都通过浏览器登陆网站,并进行一系列的查询,订购等操作。
用户接口模块包括用户信息维护、商品查询、订购商品和订单维护4个部分。
用户登陆后,用户的ID将会被保存在服务器的缓存(session)中,用户在系统中所做的操作都将被系统存储到数据库中,以供商家进行销售情况和销售走势分析。
(2)管理员接口模块。
这是系统提供给网站维护管理人员的接口。
管理员接口模块包括商品信息维护、内部员工信息维护、订单处理、销售情况查询和报表维护5部分。
网站的一般工作人员通常只有订单处理的权限,他们获得用户提交的订单,并根据库存情况来确定发货或者推迟发货。
网站管理员具有最高级的权限,可以处理客户的订单,可以浏览网站商品的销售情况,及时做出经营调整战略,降低经营风险。
(3)数据服务模块。
数据服务模块是系统正常运行的基础,它包括客户的查询订单的保存,网站工作人员的订单处理;销售情况的查询分析。
1.2用户接口模块用户接口模块包括下图2所示的几个方面。
(1)用户信息维护。
每个想在该系统中购物的用户都必须先注册,注册时的用户名是用户的唯一标识。
系统可以接受客户的个人信息,比如购物方面的喜好,经济能力等等。
系统的后台程序会自动记录每个用户在登陆网站后进行的所有操作,包括查询和订购信息,这种信息对于系统管理员是珍贵的数据,系统会根据用户的查询记录判断该用户的喜好及用户的经济情况。
商城系统软件开发时间进度表(含直播模块)

京东、天猫对接
计划时间 实际时间
移动互联系统
第三方物流公司对接 在线直播(原生开发)
计划时间 实际时间 计划时间 实际时间
电话语音系统
计划时间 实际时间
其他
seo优化 第三方推广
计划时间 实际时间 计划时间 实际时间
项目编号 xxxxxxx
负责人
7月
8月
9月
第一周 第二周 第三周 第四周 第一周 第二周 第三周 第四周 第一周
xxxxxx
9月 第二周 第三周
第四周
第一周
10月 第二周 第三周
第四周
XXX商城项目开
第一周
11月 第二周
XXX商城项目开发时间进度表
11月 第三周
第四周
第一周
12月 第二周 第三周
第四周
第一周
1月 第二周 第三周
月
2月
3月
第四周 第一周 第二周 第三周 第四周 第一周 第二周 第三周 第四周
手机微商城/小程序
计划时间 实际时间
移动互联系统
在线直播(对接第三方)
计划时间 实际时间
手机APP
计划时间 实际时间
其他
与客户系统对接接口 与厂商系统对接接口
计划时间 实际时间 计划时间 实际时间
第三阶段:商城深度开发
积分系统
计划时间 实际时间
营销模块
分销系统
计划时间 实际时间
营销系统
计划时间 实际时间
第一周
4月 第二周 第三周
第四周
第一周
5月 第二周 第三周
第四周
备注
项目名称 XX商城系统
6月
第一周 第二周 第三周
在线网上购物商城项目文档

项目组号 3密级公开湖南科技职业学院软件学院项目设计文档项目名称在线网上购物商城系统专业软件技术(CMU方向)指导教师戴臻项目组成员秦世龙黄勇泉胡成二零一二年六月1.项目开发目的:随着社会不断的变革,水平的提高“需求决定市场”,这是一个亘古未变的法则。
当下网络发展迅猛,人们对网络的信任度和依赖度均有很大的提高,这一现象被有商业头脑的人发现,从而开发出网上购物这种新型购物方式,这极大改变了传统的消费方式。
同传统的购物方式相比,网上购物有许多优点,如:方便性,节约时间,随意性。
2.项目开发背景:A、软件系统名称:在线网上购物商城系统B、任务提出者:HNS软件学院C、本系统最终提供软件学院全体师生使用;3.项目开发定义:本项目包括用户注册登陆,前台商品展示、购物车管理、订单管理,后台管理员登录,修改密码,用户管理,商品管理,订单管理等。
4.项目开发技术:本项目基于Windows Server开发的门户网站。
所用到的工具主要有NetBeans 等文本编辑器。
所使用的技术为:前台Java+struts2+jsp+hibernate后台Java+struts2+jsp+hibernate。
第1章项目开发计划书.............................................................. 错误!未定义书签。
1.1项目范围........................................................................... 错误!未定义书签。
1.2客户资料 (2)1.3项目成果 (2)1.4资源需求 (3)1.5项目风险分析 (3)1.6分配任务 (4)第2章XXX系统需求规格说明书 (5)2.1问题陈述: (6)2.2要达到的目标: (6)2.3具体的分析: (6)第3章XXX系统设计书 (11)3.1 命名规则 (12)3.2 数据库E-R图123.3软件结构图 (14)3.4构架图 (16)3.5类图 (16)3.6时序图 (17)3.7屏幕设计 (19)第4章测试计划书 (21)4.1单元测试计划 (22)4.2集成测试计划 (23)4.3性能测试计划 (24)第5章测试用例及测试报告 (25)5.1单元测试 (26)5.2集成测试 (27)5.3软件项目审核评审检验表 (28)5.4测试审核检验表 (29)5.5问题报告 (30)5.6测试报告 (30)第6章XXX系统安装手册 (32)6.1功能 (33)6.2系统解决方案: (33)6.3开发平台: (33)6.4使用技术架构: (33)6.5系统资源需求、配置要求: (33)6.6系统部署、维护要求: (33)第7章XXX系统操作手册 (34)7.1 用户管理模块操作 (35)结束语 (36)第1章项目开发计划书文件修改记录1.1项目范围项目名称:OnlineShoping使用技术: struts+hibernate初始活动:为项目开发收集各种有利于开发此软件的资料以及在线网上购物商城所需的的图片,构思项目的整体架构。
网上商城购物系统 数据库设计说明书

数据库设计说明书1.引言1.1编写目的数据库设计说明书是数据库设计的必要部分,对设计中的数据库的所有标识、逻辑结构和物理结构作出具体的设计规定,指导程序员的建立数据库的工作。
本数据库设计说明书编写的目的是说明了网上商城购物系统的数据库设计,用于明确系统中各项功能与非功能性的需求,指导系统在数据库中存储各方面的内容,为系统开发的程序员、系统分析员作为基准的文档。
预期的读者为系统的开发者、使用者和指导老师。
1.2背景说明:(1)开发软件系统的名称:网上商城购物系统;(2)任务提出者:XX;(3)开发者:计算机科学与技术的小组成员xx;(4)用户:XX;(5)本系统将使用SQLServer2000作为数据库存储系统。
1.3定义(1)Asp(active server pages)是微软公司推出的一种用以取代CGI的技术,基于目前绝大多数网站应用于windows平台,asp是一个位于windows服务器端的脚本运行环境,通过这种环境,用户可以创建和运行动态的交互式的web服务器应用程序以及EDI(电子数据交换);(2)ADO:ActiveX Data Object, ActiveX 数据对象;(3)SQL:Structured Query Language。
1.4参考资料1、《ASP程序设计及应用》张景峰主编第011903号中国水利水电出版社 2009.12、《数据库原理及其教程(第三版)》黄德才主编第088716号科学出版社 2010.63、《ASP+SQL Server动态网站开发从基础到实践》杨世锡,赵辉编著第377507号电子工业出版社 20054、《ASP+SQL Server项目开发实践》黄雷编著第38854号中国铁道出版社 2006《Dreamweaver 8与ASP动态网站开发自学导航》戎马工作室编著第298301号机5、械工业出版社 20066、《ASP实务经典》林金霖编著 [M].北京:中国铁道出版社,2001,2097、《ASP编程基础与实例》丁贵广编著 [M].北京:机械工业出版社,2002,512.外部设计2.1标识符的状态(1)本系统采用Microsoft SQL Server 2000为基本的开发工具,数据库名称为Shop,其中一共建立了7个表,表名分别为:Admin(后台管理用户表)、Users(用户信息表)、Board (公告信息表)、GoodsType(商品类别表)、Goods(商品信息表)、Basket(购物车表)、Complain(客户投诉表)(2)此表只是暂时使用的,适用于对程序的调试。
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
网上商城项目数据库表*****************************************************' 添加商品记录同步添加库存记录的触发器'*****************************************************IF EXISTS (SELECT name FROM sysobjects WHERE name = 'AddGoodsInfo' AND type = 'TR') DROP TRIGGER AddGoodsInfoGOCREATE TRIGGER AddGoodsInfo ON [dbo].[GoodsInfo]FOR INSERTASINSERT INTO GoodsSave select GoodsID,GoodsName,0,0,getdate(),getdate() from insertedGO' 删除商品记录同步删除库存记录的触发器'*****************************************************IF EXISTS (SELECT name FROM sysobjects WHERE name = 'DelGoodsInfo' AND type = 'TR') DROP TRIGGER DelGoodsInfoGOCREATE TRIGGER DelGoodsInfo ON [dbo].[GoodsInfo]FOR DELETEASDELETE from GoodsSave where GoodsID = (SELECT GoodsID FROM deleted)GO'*****************************************************' 重新同步商品在库存表中的对应记录的存储过程'*****************************************************CREATE PROCEDURE BindGoodsToSave ASIF EXISTS (SELECT name FROM sysobjects WHERE name = 'GoodsSave' AND type = 'U') BEGINDROP TABLE GoodsSavecreate table GoodsSave (GoodsSaveID integer identity,GoodsID integer null,GoodsName nvarchar(100) null,SaveNum integer null default 0,SaveAddNum integer null default 0,SaveTime datetime null default getdate(),SaveAddTime datetime null default getdate(),constraint PK_GOODSSAVE primary key (GoodsSaveID))ENDELSEBEGINcreate table GoodsSave (GoodsSaveID integer identity,GoodsID integer null,GoodsName nvarchar(100) null,SaveNum integer null default 0,SaveAddNum integer null default 0,SaveTime datetime null default getdate(),SaveAddTime datetime null default getdate(),constraint PK_GOODSSAVE primary key (GoodsSaveID))ENDINSERT INTO GoodsSave(GoodsID,GoodsName) select GoodsID,GoodsName from GoodsInfo order by GoodsID'*****************************************************' 按日期和月份统计注册人数的存储过程'*****************************************************CREATE procedure GetRegUsers@id intASdeclare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录IDdeclare @tempRegDate nvarchar(10) --临时表日期set nocount onif (@id = 0)begininsert into @table(RegDate)select distinct convert(char(10),UserCreateTime,120) from Users order by convert(char(10),UserCreateTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from Users whereconvert(char(10),UserCreateTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendelsebegininsert into @table(RegDate)select distinct convert(char(7),UserCreateTime,120) from Users order by convert(char(7),UserCreateTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from Users whereconvert(char(7),UserCreateTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorset nocount offselect * from @table where RegDate is not nullGO'*****************************************************' 按日期和月份统计用户订单的存储过程'*****************************************************CREATE procedure GetUserOrders@id intASdeclare @table table(ID int IDENTITY(1,1),RegDate nvarchar(10),RegNum int) declare @tempId int --临时表记录IDdeclare @tempRegDate nvarchar(10) --临时表日期set nocount onif (@id = 0)begininsert into @table(RegDate)select distinct convert(char(10),OrderTime,120) from GoodsOrder order by convert(char(10),OrderTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(10),OrderTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendbegininsert into @table(RegDate)select distinct convert(char(7),OrderTime,120) from GoodsOrder order by convert(char(7),OrderTime,120) descdeclare _cursor cursor for select Id,RegDate from @tableopen _cursorfetch next from _cursor into @tempId,@tempRegDatewhile @@fetch_status = 0beginupdate @table set RegNum=(select count(UserID) from GoodsOrder where convert(char(7),OrderTime,120) = @tempRegDate)where ID = @tempIdfetch next from _cursor into @tempId,@tempRegDateendclose _cursordeallocate _cursorendset nocount offselect * from @table where RegDate is not nullGO。