数据库设计示例文档(完整)物理数据库设计

  • 格式:doc
  • 大小:28.00 KB
  • 文档页数:9

下载文档原格式

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

数据库设计示例文档(完整)物理数据库设计D2小组网上培训系统物理数据库设计

陈俊华、董磊、陈俊娜、董昊、海霞、郭云龙

1(针对选定的DBMS,生成基表

由于本系统主要架构在windows操作系统之上,加之本小组成员对SQLServer 比较熟悉,且系统有并发操作的要求,因此决定采用SQLServer2000 DBMS系统。

2(选择合适的文件组织(Heap, Hash, ISAM, B+ Tree, Clustered)

基于在System’s Specification中对系统性能的要求:

1)非峰值时,数据查找、更新、存储的平均时间低于1秒

2)在峰值时,数据查找、更新、存储的平均时间低于5秒

采用SQL Server 2000默认的文件组织结构

3(选择建立适当的索引

基于在System’s Specification中对事务处理的分析:

1)学生情况检索每天50次

2)教师情况检索每天10次

3)课程检索每天100次

4)常见问题检索每天200次

5)资料查询每天200次

6)试题检索每天50次

7)成绩查询每天50次

在SQL Server 2000里,在数据库关系图中为表定义一个主键将自动创建主键索引;由于要频繁查询学生姓名、教师姓名、课程名称、题目、成绩,因此在各表的对应列上创建第二索引。

4(定义全局约束

根据需求分析,本网上培训系统不允许同一名学生在一个学期中选课超过6 门以上。

5(定义视图

用户视图主要是学生视图和教师视图。

6(定义用户访问控制规则

用户在进入系统之前必须提交相应的用户名和口令,系统将根据不同的用户而授予不同的权限。

以下是建表语句:

1)学生表

create table student(

StudentID Int(15) not null identity(1,1), StudentName Varchar(20) not null,

StudentPassword Varchar(10) not null,

StudentStatus Char(1) not null,

StudentSex Char(1) not null,

EnrollingDate Datetime not null,

E-mail Varchar(30),

Constraint pk_student primary key clustered(StudentID) )

索引:

create index student_StudentName on student(StudentName)

2)教师表

create table teacher (

TeacherID Int(15) not null identity(1,1), TeacherName Varchar(20) not null,

TeacherPassword Varchar(10) not null,

TeacherState Char(1) not null,

TeacherSex Char(1) not null,

TelNO Int(12),

E-mail Varchar(30),

Constraint pk_teacher primary key clustered(TeacherID) )

索引:

create index teacher_TeacherName on teacher(TeacherName)

3)课程表

create table course (

CourseID Int not null identidy(1,1), CourseName Varchar(100) not null,

MajorID Int,

CourseType Int,

CourseCreated Datetime not null,

CourseStart Datetime not null,

CourseEnd Datetime not null,

CourseTime Int not null,

CourseScore Int not null,

CourseState Char(1) not null,

CourseIntro Text,

Constraint pk_course primary key clustered(Course_ID) )

索引:

create index course_CourseName on course(CourseName)

4)课堂表

create table Classroom (

SerialNo Int not null identity(1,1), ClassBegin Datetime,

ClassEnd Datetime,

onlineBegin Datetime not null, onlineEnd Datetime,

Constraint pk_course primary key clustered(SerialNo) )

5)申请课程表

create table application (

ApplyID Int not null identity(1,1), StudentID Int not null, ApplyDate Int not null, CourseID Datetime not null, ApplyType Char(1) not null, ApplyState Char(1) not null, ApplyContent Varchar(200), Constraint pk_course primary key clustered(ApplyID), Constraint ApplicationCourseTooMuch

CHECK(NOT EXISTS(SELECT StudentID

FROM application

GROUP BY StudentID

HAVING COUNT(*)>6))

FOREIGN KEY (StudentID) REFERENCES Student (StudentID)

ON UPDATE CASCADE ON DELETE NO ACTION, FOREIGN KEY (CourseID) REFERENCES Course (CourseID)

ON UPDATE CASCADE ON DELETE NO ACTION )

6)课程学生表