服装店管理系统数据库原理与应用实验报告三

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

课程名称:数据库原理与应用

连锁服装店的服装销售管理系统

一、系统总ER图

二、功能分析

本系统针对的是负责某个特定品牌的服装销售数据库管理系统,如以纯、温拿等固定品牌,仓库进货时,根据会计分录的方法,对产品数据的管理主要依靠产品的编号,例如设置服装1的产品编号形如“000000”,第一位数是1的就代表上衣、是2就代表裤子……依次对不同的产品进行数据进行区分;第二位数就表示服装的季节性,如1代表是春装、2代表夏装……;第三位数表示产品的材质,如1表示棉料、2代表布料……;还有的位数代表数量。服装2是对服装1的细分,在此是依据服装2的编号和尺码来进行管理,如将编号设置成“000000”,可采取用前几位数代表衣服的款型,中间的位数代表尺码,后几位表示数量。由特定的员工管理仓库物品,对数据库中各个产品的销售情况进行统计分析,设置一些进货标准,看哪些货物需要采购、对库存积

压过多的货物进行促销、或者要进行换季衣服打着促销等。

三、数据库表的结构

仓库信息表:stowage

工资信息表:salary

四、关系模型

R1:服装店(店编号,店名,店址,店长名,店里电话)

R2:仓库(仓库编号,仓库名,仓库地址,仓库管理者名,仓库电话)

R3:服装1(服装1编号,服装1穿着类型,服装1的季节类型,服装1的材质类型

,服装1不同类型的数量)

R4:服装2(服装2编号,服装2的码数,服装2的进货价,服装2的售价,服装2同编号不同尺码的数量)

R5:员工(职工号,职工姓名,身份证号,职工年龄)

R6:工资(职工号,发工资时间,基本工资,提成,销售成绩)

R7:客户(店编号,客户编号,消费时间,服装2编号,服装2码数,服装2购买数量顾客名,住址,消费金额,电话)

五、建立数据库和表的程序

建立名为clomanage数据库:

create database clomanage

1、创建关于服装店基本信息表

create table clothing_store(cno char(10)primary key,

cname char(20)not null,cadress char(50)not null,

cprinciple char(10)not null,cphone char(20)not null)

2、创建关于仓库基本信息表

create table stowage(sno char(10)primary key,

sname char(20)not null,sadress char(50)not null,

sprinciple char(10)not null,sphone char(20)not null)

3、创建关于服装1基本信息表

create table array1(a1no char(10)primary key,

a1type1 char(20)not null,a1type2 char(20)not null,

a1type3 char(20)not null,a1quantity int not null)

4、创建关于服装2基本信息表

create table array2(a2no char(10)primary key,

a2price1 money not null,a2price2 money not null,

a2size char(5)not null,a2quantity int not null)

5、创建关于员工基本信息表

create table worker(wno char(10)primary key,

wname char(20)not null,wid char(30)not null,

wage int not null)

6、创建关于工资基本信息表

create table salary(wno char(10),base_money money not null,

wtime datetime,mtc money not null,

mcj int not null,primary key(wno,wtime))

7、创建关于客户基本信息表

create table client(cno char(10),ccno char(10),

ccname char(20)not null, a2no char(10)not null, a2size char(5)not null, cquantity int not null,ccaddress char(50)not null,

cccprice money not null,ccphone char(20)not null,

cctime datetime not null,primary key(cno,ccno,cctime))

六、创建视图、索引、存储过程、触发器

1、可以往表中插入数据或者批量导入数据

如:insert into salary

values('0916141',1000,'2012-1-12',200,50)

创建一个包含员工号、发工资时间和业绩且职工编号是09161—开始的视图

create view salary_view

as

select wno,wtime,mcj from salary

where wno like'09161%'

2、创建索引

(1)可为salary表的mtc字段创建索引mtc_index

create index mtc_index on salary(mtc)

(2)为salary表中的”wno”和”wtime”字段创建一个符合唯一索引

create unique index wno_wtime_index on salary(wno,wtime)

用存储过程sp_helpindex查看salary表的索引信息

sp_helpindex salary

3、创建存储过程

create procedure dian_client

@cno char(10),

@ccno char(10),

@cctime datetime,

@a2no char(10),

@a2size char(5),

@a2price2 money,

@cquantity int

as

begin

select clothing_o,ccno,cctime,array2.a2no,array2.a2size, array2.a2price2,cquantity from clothing_store,array2,client where clothing_o=@cno and array2.a2no=@a2no and

array2.a2size=@a2size and array2.a2price2=@a2price2

end

查看存储过程代码:

exec sp_helptext'dian_client'

相关文档
最新文档