当前位置:文档之家› 某宾馆客房管理系统

某宾馆客房管理系统

《数据库系统》课程实践任务报告任务名称:某宾馆客房管理系统班级 ________________学号 _______________姓名 _________________学号 ________________姓名 ___________________完成日期: 2015年06月30日信息工程学院计算机系任务名称:某宾馆客房管理系统1 .任务的描述随着宾馆业竞争的加剧,传统的宾馆计算机管理系统已无法满足宾馆信息化管理的需要。

为了拓展经营空间、降低成本和提高管理效率,宾馆需要使用更高效的信息化手段,借助先进的计算机信息技术对宾馆进行管理。

因此为了对某宾馆实现客房情况的信息化管理,特设计并实现一个涉及到SQL Server数据库的重要数据库对象、功能和特性的某宾馆客房管理系统,新的宾馆客房管理系统科学的将宾馆各种业务完美的结合,方便管理和决策,并且能提供大量的管理经营过程中实际的数据。

宾馆客房管理系统要求实现以下功能:1、实现客房类型、价目信息、客房信息的管理;2、实现客户信息的管理;3、实现入住和退房管理;4、实现费用管理;5、创建触发器,实现入住和退房时自动修改客房的状态;6、创建存储过程统计某段时间内各种类型的客房的入住时间合计和费用合计;7、创建视图查询某一时刻没有入住的房间信息;8、建立数据库相关表之间的参照完整性约束。

2 .需求分析本系统主要包括的外部实体有:客户、客房信息、客户住宿、前台、客房状态,要实现的功能主要有:客户、客房等信息的管理。

2.1系统包含的实体根据“任务描述”中提供的信息以及系统需要实现的功能,本系统应包含的实体及其包含的属性名如下:客户(身份证号码,姓名,性别,出生日期地址)前台(编号,姓名)客房信息(客房号,客房类型,客房数量,价格,客房状态)客户住宿(客房号,客房类型,入住时间,消费费用,住宿时间,退房时间)费用(客房类型,房费,消费费用,押金)入住信息(入住编号,入住时间,入住人数)退房信息(退房编号,退房时间)客房类型(类型编号,类型名称,价格)楼层信息(楼层编号,楼层名)2.2 系统包含的实体间联系根据“任务描述”中提供的信息以及宾馆的实际情况,本系统中实体之间应有如下的联系:存在联系:实体“客户”与“客房”之间的联系,包含属性:客房号。

联系类型:一对多。

入住联系:实体“客户”与“入住信息”之间的联系,不包含属性。

联系类型:一对多。

住宿联系:实体“客房”与“客户住宿”之间的联系,包含属性:客房号,客房类型。

联系类型:一对多。

包含联系:实体“客房”与“客房类型”之间的联系,不包含属性。

联系类型:一对多。

属于联系:实体“客房”与“楼层信息”之间的联系,不包含属性。

联系类型:多对多。

管理联系:实体“客户”与“前台”之间的联系,不包含属性。

联系类型:一对多。

2.3 系统需实现的功能根据“任务描述”中提供的信息以及宾馆的实际情况,本系统需具有如下的功能:1、对本系统中具有的实体及实体间联系的信息存储;2、具体有如下的静态查询:1)对客房信息(客房号、收费标准、类型、入住情况)的查询:2)对客户信息(身份证号、居住地址、姓名、性别、出生日期等)的查询;3)对客户住宿信息(客房号,客房类型,入住时间,住宿费用,住宿时间,退房时间)的查询 ;4)对客房状态(入住、退房)的查询 ;3、具体有如下的动态查询:1)给定身份证号码,查询该客户的身份信息、客户住宿信息;2)给定客房号,查询该客房的信息、客房状态 ;2.4 数据流图根据“需要分析”中对本系统包含的实体及需要实现的功能的描述,设计并绘制出本系统的数据流图如下 :(1)第一层数据流图在户SFtSS.■II」■111MirniOS11F—q >■(2)第二层数据流图2.5数据字典根据数据流图中的实体、数据存储,本系统需要如下数据字典:(1)数据字典名:客户表示的对象:客户实体数据结构:客户=姓名(字符串类型)+性别(字符串类型)+地址(字符串类型)+ 出生日期(日期类型)+身份证号(字符串类型)+电话(字符串类型)(2)数据字典名:前台表示的对象:前台实体数据结构:前台 = 姓名(字符串类型) +性别(字符串类型) (3)数据字典名:客房表示的对象:客房实体数据结构:客房 = 客房号(整型) +客房类型(字符串类型) +客房数量(整型) +价 格(整型) + 客房状态(字符串类型)(4)数据字典名:客户住宿 表示的对象:客户住宿实体 数据结构:客户住宿 =客房号(整型) +客房类型(字符串类型) + 住宿时间(字符串 类型)+ 消费费用(整型) +入住时间(字符串类型) +退房时间(字符串类型) (5)数据字典名:客房类型表示的对象:客房类型实体数据结构:客房类型 = 类型编号(字符串类型) + 类型名称(整型)6)数据字典名:账单信息 表示的对象:账单信息实体 数据结构:账单信息 =客房类型(字符串类型) +消费费用(整型) +房费(整型) + 押金(整型) 7)数据字典名:入住信息 表示的对象:入住信息实体3. 数据库概念数据模型设计根据“需求分析”中对本系统包含的实体及实体间联系的描述, 本系统的数据库概念数据 模型图如下:数据结构:入住信息 = 入住编号(定长字符串类型) (字符串类型) 8)数据字典名:退房信息 表示的对象:退房信息实体数据结构:退房信息 = 退房编号(定长字符串类型) 9)数据字典名:楼层信息 表示的对象:楼层信息实体数据结构:楼层信息 = 楼层编号(定长字符串类型) + 入住人数(整型) + 入住时间 + 退房时间(字符串类型) + 楼层名(字符串类型)4 .数据库逻辑数据模型设计此处根据数据库概念数据模型和数据库概念模型向关系数据库模型转换的规则, 生成出系统的数据库逻辑数据模型。

£1=- . 3-t5.数据库物理数据模型设计此处根据数据库概念数据模型生成数据库物理数据模型后,截图粘贴到此处ha>F啞于誉逞- 鱼習广客馬、\▼蛋强iSP 9宴翼笑型1中害身状态)6 n隹氓S n|-.l/e-.K stt 亠牙亠芳“宝.帝靑長 砂寻書.\住堪灣 秤片|0; O 0 0入住d, J1「入住信邑二人住时间 ,芒人住人戯..n 共丘逗冃0労玄 6俺異耳£ o 拦金雷翳零金12EHrt境出瞇0. 1工耳号J*空姓客 性刮 二聲曲憧息M 2身林』咎愷嚏1悬息字 W 福号〈UnWwfLMti 〉4k> 懂咚老 CVndtf intd?客房矣虱口壬 jfi 号(Undm F i n«d > 5k> 粪型冬殊<Und*fins<i> 中塔 <Endefined>6 .建立数据库的SQL 代码if exists(select 1 from sys.sysforeignkey where role='FK_ENTITY_6_RELATIONS_ 客户') thenalter table En tity_6delete foreig n key FK_ENTITY_6_RELATIONS_ 客户 end if;if exists(select 1 from sys.sysforeig nkey whererole='FK_ alter table 客户delete foreig n key FK_ 客户—RELATIONS —客房end if;if exists(select 1 from sys.sysforeig nkey where role='FK_前台塞吕■■:jjju:! w f 丄 m ■!■■: 姓卷 rarthai (20)客房宴旁号 €匸!1:1己£:11岸日;C3LS-B =土*±?GB#7S 皋蛋丐 <E ±ieS ,ixfii?客戾塑型<Undefined ; gr ft. J-& A- £ n id h3y■■]司同s备:盅时«麻r工AJriEiEf :.d 》:qkA二门已日〉"k> <Undtfined> <Und €:f ined>=_-=二=一二」亠二辽sr -v ar char(ZO} char {2 long varcha. t iztestaziE char 111)遑畀售.昌:巨 骂扁考 t Un tie f:iigd 》sk 》H 兀 <Uhd«flnad>瞰单直息M 房矣奎GdmfzinE :!》"苕liirfli ;<ft>扇吳 <Vnd*f intd> 濡授捷右<Und«finsd> 捋金 <Undtfintd>入住幷-司 <lTn[iefinecj> 入住人數<Undtf客户 _RELATIONS_客房') the n客户 _RELATIONS_ENTITY_8')thenalter table 客户delete foreign key FK_ 客户 _RELATIONS_ENTITY_ end if;if exists(select 1 from sys.sysforeignkey where role='FK_ then alter table 客户delete foreign key FK_ 客户 _RELATIONS_ENTITY_ end if;if exists(select 1 from sys.sysforeignkey where role='FK_ then alter table 客户住宿delete foreign key FK_ 客户住宿 _RELATIONS_客房 end if;if exists(select 1 from sys.sysforeignkey where role='FK_ alter table 客房delete foreig n key FK_ 客房—RELATIONS—前台 end if;if exists(select 1 from sys.sysforeignkey where role='FK_ then alter table 客房delete foreig n key FK_ 客房 _RELATIONS_ENTITY_ end if; if exists(select 1 from sys.sysforeignkey where role='FK_ thenalter table 客房delete foreign key FK_ 客房 _RELATIONS_ENTITY_1 end if; drop index if exists Entity_10.Entity_10_PK;drop table if exists Entity_10;drop index if exists Entity_6.Relationship_7_FK;drop index if exists Entity_6.Entity_6_PK;drop table if exists Entity_6;drop index if exists Entity_7.Entity_7_PK;drop table if exists Entity_7;drop index if exists Entity_8.Entity_8_PK;drop table if exists Entity_8;drop index if exists Entity_9.Entity_9_PK;drop table if exists Entity_9;drop index ifexists前台•前台_PK;drop table ifexists前台 ;drop index if exists客户.Relationship_5_FK;客户_RELATIONS_ENTITY_9')客户住宿—RELATIONS—客房')客房_RELATIONS_ 前台')then客房_RELATIONS_ENTITY_7')客房_RELATIONS_ENTITY_1')drop index ifexists客户.Relationship_4_FK;drop index ifexists客户 .Relationship_3_FK;drop index ifexists客户.客户_PK;drop table ifexists客户 ;drop index if exists客户住宿 .Relationship_6_FK;drop index ifexists客户住宿.客户住宿 _PK;drop table ifexists客户住宿;drop index ifexists客房.Relatio nship_8_FK;drop index ifexists客房.Relatio nship_2_FK;drop index ifexists客房.Relatio nship_1_FK;drop index ifexists客房.客房_PK;drop table ifexists 客房;/*==============================================================*//* Table: Entity_10 *//*===================================================== =========*/ create table Entity_10(Attribute_34 char(10) not null,Attribute_35 char(10) null,constraint PK_ENTITY_10 primary key (Attribute_34));/*===================================================== =========*//* Index: Entity_10_PK */ /*===================================================== =========*/create unique index Entity_10_PK on Entity_10 (Attribute_34 ASC);/*==============================================================*//* Table: Entity_6 */ /*==============================================================*/create table Entity_6(Attribute_21 char(10) not null,身份证号char(18) null, Attribute_22 char(10) null,Attribute_23 char(10) null, Attribute_24 char(10) null, constraint PK_ENTITY_6 primary key (Attribute_21));/*===================================================== =========*/ create unique index Entity_6_PK on Entity_6 ( Attribute_21 ASC );/*===================================================== =========*//* Index: Relationship_7_FK *//*===================================================== =========*/create index Relationship_7_FK on Entity_6 ( 身份证号 ASC );/*===================================================== =========*//* Table: Entity_7 */ /*===================================================== =========*/ create table Entity_7 (Attribute_26 Attribute_27 Attribute_28constraint PK_ENTITY_7 primary key (Attribute_26) );char(10) char(10) char(10)not null, null, null,/*===================================================== =========*/ create unique index Entity_7_PK on Entity_7 ( Attribute_26 ASC );/*===================================================== =========*/ /* Table: Entity_8 *//*===================================================== =========*/ create table Entity_8 (Attribute_29 char(10)Attribute_30 char(10) Attribute_31char(10)constraint PK_ENTITY_8 primary key (Attribute_29) );/*===================================================== =========*//* Index: Entity_8_PK */ /*===================================================== =========*/create unique index Entity_8_PK on Entity_8 ( Attribute_29 ASC );/* Table: Entity_9 *//*===================================================== =========*/ create table Entity_9(Attribute_32 char(10) not null, Attribute_33char(10)null,constraint PK_ENTITY_9 primary key (Attribute_32)not null, null, null,);/*===================================================== =========*//* Index: Entity_9_PK */ /*==============================================================*/create unique index Entity_9_PK on Entity_9 (Attribute_32 ASC);/*===================================================== =========*//* Table: 前台 */ /*===================================================== =========*/ create table 前台(编号char(10) not null,姓名varchar(20) null,constraint PK_ 前台 primary key ( 编号 ));/*===================================================== =========*//* Index: 前台 _PK */ /*==============================================================*/create unique index 前台 _PK on 前台(编号 ASC);/*===================================================== =========*//* Table: 客户*//*===================================================== =========*/create table 客户(身份证号char(18) not null Attribute_32 char(10) null,客房号char(10) null, Attribute_29 char(10) null,姓名varchar(20) null,性别char(2) null,地址long varchar null,出生日期timestamp null,电话char(11) null,constraint PK_ 客户 primary key ( 身份证号 ));/*===================================================== =========*//* Index: 客户 _PK *//*===================================================== =========*/create unique index 客户 _PK on 客户(身份证号 ASC);/*===================================================== =========*//* Index: Relationship_3_FK *//*===================================================== =========*/create index Relationship_3_FK on 客户(客房号 ASC);/*===================================================== =========*/ /* Index: Relationship_4_FK /*===================================================== =========*/*/create index Relationship_4_FK on 客户(Attribute_29 ASC );/*===================================================== =========*//* Index: Relationship_5_FK *//*===================================================== =========*/create index Relationship_5_FK on 客户(Attribute_32 ASC-__n u_-n u o uw K S J r(OL)」euo (OL)」euo(0L)」elp(OL)」euo(OL)」euo叵起也<8L I 2n £」=<卜L I 2n £」=<a>q e-Lo s <8L I 2n q €<o s <卜 L I 2n £」=< ) 型也丄w u o y d —型也丄曲x①pu一①n b c n ①苍①」。

相关主题