烟台大学回音壁数据库

上传人:灯火****19 文档编号:124383976 上传时间:2020-03-11 格式:DOCX 页数:13 大小:346.93KB
返回 下载 相关 举报
烟台大学回音壁数据库_第1页
第1页 / 共13页
烟台大学回音壁数据库_第2页
第2页 / 共13页
烟台大学回音壁数据库_第3页
第3页 / 共13页
烟台大学回音壁数据库_第4页
第4页 / 共13页
烟台大学回音壁数据库_第5页
第5页 / 共13页
点击查看更多>>
资源描述

《烟台大学回音壁数据库》由会员分享,可在线阅读,更多相关《烟台大学回音壁数据库(13页珍藏版)》请在金锄头文库上搜索。

1、回音壁需求分析数据库管理员:管理员编号、姓名、密码。管理员的功能就是审核留言是否通过、以及发布通告部门分类的信息:有部门分类的编号,部门分类的名称。部门的信息:部门编号、部门名称、所属部门分类、部门管理者部门管理者有回复留言的权限用户的信息:编号、姓名、密码用户有查询留言与留言的权限留言的信息:留言编号、留言者、回复留言的部门、留言的标题、留言的内容、发表的时间(默认当前时间)、是否匿名、留言者的联系方式、是否已回复、回复时间、是否审核(三种状态:审核通过、未通过、未审核)通知公告:通知公告编号、发布人、标题、内容、日期实体ER图管理员实体ER图:部门分类实体ER图:部门实体ER图:用户的实体

2、ER图:留言的实体ER图:通告的实体ER图:实体之间的联系:概念模型:数据库逻辑设计1、 管理员表:Manages属性类型是否为空描述Manage_idChar(12)Not null管理员编号,主键Manage_nameVarchar(25)Not null管理员姓名Manage_pwdChar(12)Not null管理员密码2、 通告板表:Messages属性类型是否为空描述Message_idintNot null通告编号,自增主键Message_objectVarchar(100)Not null通告标题Message_conmentText null通告内容Message_date

3、dateNot null发布通告的日期默认为当前日期Message_MidChar(12)Not null发布通告者,外键、级联删除3、 部门分类表:Department_Class属性类型是否为空描述DC_idintNot null部门分类编号,自增主键DC_nameVarchar(25)Not null部门分类名称4、 部门表:Departments属性类型是否为空描述Department_idintNot null部门编号,自增,主键Department_nameVarchar(25)Not null部门名称Departments_CL_idintNot null所属部门,外键5、 用户

4、表:Users属性类型是否为空描述User_idChar(12)Not null用户编号,主键User_nameVarchar(25)Not null用户名称User_pwdChar(12)Not null用户密码User_Didintnull用户管理的部门,外键,置空删除6、 留言表:Leave_Messages属性类型是否为空描述LM_idChar(12)Not null留言的编号,主键LM_DidintNot null回复部门,外键级联删除LM_UidChar(12)Not null留言者,外键级联删除LM_objectVarchar(100)Not null标题LM_comenttex

5、t null内容LM_isreplyedintNot null是否回复,回复为1,未回复为0,默认0LM_Issue_datedateNot null发布日期,默认当前时间LM_reply_datedate null回复日期LM_isanonymityintNot null是否匿名,匿名为1,实名为0,默认0LM_phoneChar(11)Not null留言者的联系方式LM_IsthroughintNot null是否通过审核,1带便通过审核,0代表审核未通过,2代表审核未完成代码:-创建数据库 YTDreplyCreate database YTDreplyon primary(name=

6、SuperMarketdb,filename=C:Program Files (x86)Microsoft SQL ServerMSSQL.4MSSQLDataSuperMarketdb.mdf,size=100MB,maxsize=200MB,filegrowth=20MB)log on(name=SuperMarketlog,filename=C:Program Files (x86)Microsoft SQL ServerMSSQL.4MSSQLDataSuperMarketdb.ldf,size=60MB,maxsize=200MB,filegrowth=20MB)-创建管理员表:Ma

7、nagescreate table Manages(Manage_id char(12) not null constraint PK_Manages primary key,Manage_name Varchar(25) not null,Manage_pwd char(12) not null)-创建通告板表:Messagescreate table Messages(Message_id int not null identity constraint PK_Messages primary key,Message_object varchar(100) not null,Message

8、_conment text null,Message_date datetime default(getdate()not null,Message_Mid char(12) not null,constraint FK_Manage_Manages foreign key(Message_Mid) references Manages(Manage_id) on delete cascade-创建外键约束和级联删除约束)-创建部门分类表:Department_Classcreate table Department_Class(DC_id int not null identity cons

9、traint PK_Department_Class primary key,DC_name varchar(25) not null)-创建部门表:Departmentscreate table Departments(Department_id int not null identity constraint PK_Departments primary key ,Department_name varchar(25) not null , Departments_CL_id int not null,constraint FK_Department_Class_Departments f

10、oreign key (Departments_CL_id) references Department_Class(DC_id) on delete cascade-建立外键和级联删除约束)-创建用户表Userscreate table Users(User_id char(12) not null constraint PK_Users primary key ,User_name varchar(25) not null,User_pwd char(12) not null,User_Did int null,constraint FK_Departments_Users foreign

11、 key(User_Did) references Departments(Department_id) on delete set null-置空删除)-创建留言表Leave_Messagescreate table Leave_Messages(LM_id char(12) not null constraint PK_Leave_Messages primary key,LM_Did int not null, LM_Uid char(12) not null, LM_object varchar(100) not null, LM_coment text null, LM_isrepl

12、yed int check(LM_isreplyed in (0,1)default(0), LM_Issue_date datetime default(getdate() not null, LM_reply_date datetime null, LM_isanonymity int not null check(LM_isanonymity in (0,1) default(0), LM_phone char(11) null, LM_Isthrough int check(LM_Isthrough in (0,1,2),constraint FK_Department_Leave_Messages foreign key(LM_Did) references Departments (Department_id) on delete cascade,constraint FK_Users_Leave_Messages foreign key(LM_Uid) references Users (User_id) on delete cascade)

展开阅读全文
相关资源
相关搜索

当前位置:首页 > IT计算机/网络 > 其它相关文档

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号