会议室预定系统数据库文件BookRoom

/*

本SQL脚本是本人毕业设计“会议室预定系统”的数据库文件,名为BookRoom.sql

DBMS:MySQL

*/

 

 

 

/*==============================================================*/

/* DBMS name:      MySQL 5.0                                    */

/* Created bookRoomon:     2009/03/15 19:55:29                          */

/*==============================================================*/

 

/*==============================================================*/

/* Database: BookRoom                                         */

/*==============================================================*/

create database if not exists BookRoom;

 

Use BookRoom;

 

drop table if exists tblEmployee;

 

drop table if exists tblRoom;

 

drop table if exists tblReserve;

 

 

/*==============================================================*/

/* Table: tblEmployee                                           */

/*==============================================================*/

create table if not exists tblEmployee

(

   empId           int not null AUTO_INCREMENT comment 'primary key can not have a default value',

   empCardNo         varchar(20) default '' comment 'Employee ID can be leaded by 0,  so we set it''s type varchar.',

   empName           varchar(100) default '',

   empSex            varchar(20) default '',

   empWorkDateBegin  date default NULL comment 'YYYY-MM-DD',

   empTel            varchar(100) default '' comment 'It can either be a mobile telephone number or a office telephone number or both.',

   empEMail          varchar(100) not null unique default '' comment 'this empty string equals the dbms own default value',

   empPwd            varchar(100) not null default '',

   empRole varchar(50) not null default '',

   constraint empId primary key (empId)

)engine=InnoDB, charset=utf8, comment='Every person including the boss in the company is defined as employee';

 

/*

create index idxEmpId on tblemployee(empId);

create index idxEmpEMail on tblemployee(empEMail);

*/

 

/*==============================================================*/

/* Table: tblRoom                                             */

/*==============================================================*/

create table if not exists tblRoom

(

   roomId            int not null AUTO_INCREMENT comment 'Generated by the database automatically.',

   roomBuilding        varchar(100) not null default '' comment 'When you reserve a meeting room, you may firstly choose a building. 

            And then choose one meeting room in the building.

            Of course all the buildings and meeting rooms are listed for you.',

   roomNo              varchar(50) default '' comment 'Meeting rooms belong to every building are listed out for choosing.',

   roomName            varchar(100) not null default '',

   roomAddr            varchar(300) default '',

   constraint roomId primary key (roomId)

)engine=InnoDB, charset=utf8, comment='There are meeting rooms, which names may be the same(eg:"The First Meeting Room';

 

/*create index idxRoomId on tblRoom(roomId);*/

 

/*==============================================================*/

/* Table: tblReserve                                        */

/*==============================================================*/

create table if not exists tblReserve

(

   rsrvId          int not null AUTO_INCREMENT comment 'Generated by the database automatically.',

   empId           int not null default 0 comment 'the default value of foreign key is better',

   roomId          int not null default 0,

   rsrvDateBegin     date not null comment 'if it is not null, its default value should be null',

   rsrvDateEnd       date not null,

   rsrvTimeBegin     time not null,

   rsrvTimeEnd       time not null,   

   rsrvMtTitle       varchar(100) default '',

   rsrvDateTime      datetime default NULL,

   constraint rsrvId primary key (rsrvId),

   constraint empId foreign key (empId) REFERENCES tblEmployee(empId) on delete cascade on update cascade,

   constraint roomId foreign key (roomId) REFERENCES tblRoom(roomId) on delete cascade on update cascade

)engine=InnoDB, charset=utf8;

 

/*

create index idxRsrvId on tblReserve(rsrvId);

create index idxEmpId on tblReserve(empId);

create index idxRoomId on tblReserve(roomId);

*/

 

/*向员工表tblEmployee插入测试数据*/

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M00001', 'admin', 'female', '2000-01-01', 

'024001', 'admin@neusoft.com', '21232f297a57a5a743894a0e4a801fc3', 'admin');

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M01395', 'xielj', 'male', '2009-07-01', 

'13073548356', 'xielj@neusoft.com', 'eb530b803b2c31fea96cda98a8eb377d', 'user');

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M00002', 'linice', 'male', '2009-07-01', 

'13080719544', 'linice@neusoft.com', '4937ab52f35373e3391d5b98a4817258', 'user');

 

insert into tblEmployee(empCardNo, empName, empSex, empWorkDateBegin, 

empTel, empEMail, empPwd, empRole)

values('S200707M01395', 'neusoft', 'female', '2000-07-01', 

'024002', 'neusoft@neusoft.com', 'f7377865580a02f9a89533b31e4ca7b7', 'user');

 

 

/*向会议室表tblRoom插入测试数据*/

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '101', 'linux', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '102', 'C#', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('conference center', '201', 'sql', 'conference center');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '101', 'java', 'A1');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '102', 'C', 'A1');

 

insert into tblRoom(roomBuilding, roomNo, roomName, roomAddr)

values('A1', '103', 'C++', 'A1');

 

 

/*向预定表 tblReserve 插入测试数据*/

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '6:00', '8:00', 'why to learn java275', '2009-4-30 9:00');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '13:00', '15:00', 'how to learn java275', '2009-4-30 15:45');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '9:00', '11:00', 'learn java314', '2009-5-2 17:1');

bookmtroom

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '15:00', '17:00', 'why to learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '4:00', '6:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '9:00', '14:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '7:00', '13:00', 'learn japanese', '2009-5-7 8:30');

 

insert into tblReserve(empId, roomId, rsrvDateBegin, rsrvDateEnd, 

rsrvTimeBegin, rsrvTimeEnd, rsrvMtTitle, rsrvDateTime)

values(2, 4, '2009-5-2', '2009-5-2', '7:00', '14:00', 'learn japanese', '2009-5-7 8:30');

 

 

 

 

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值