1、数据库建模设计
(1) 列出实体:
学生 | Student |
系 | Department |
专业 | Specialty |
班 | Class |
课程 | Course |
教师 | Teacher |
课程类别 | CourseCategory |
(2) 列出实体的联系、联系类型和多重性的值:
(3) 列出实体属性和属性的域:
Student表
列 | 类型 | 说明 |
---|---|---|
s_id | int | 学生编号,主键 |
s_name | nvarchar(10) | 学生姓名 |
s_sex | nchar(1) | 学生性别 |
s_address | nvarchar(50) | 家庭住址 |
s_credit | int | 学生学分 |
s_time | Data | 入学时间 |
Teacher表
列 | 类型 | 说明 |
---|---|---|
t_id | int | 教师编号,主键 |
t_name | nvarchar(10) | 教师姓名 |
t_sex | nchar(1) | 教师性别 |
Department表
列 | 类型 | 说明 |
---|---|---|
d_id | int | 系院编号,主键 |
d_name | nvarchar(10) | 系院名称 |
Specialty表
列 | 类型 | 说明 |
---|---|---|
s_id | int | 专业编号,主键 |
s_name | nvarchar(10) | 专业名称 |
Class表
列 | 类型 | 说明 |
---|---|---|
c_id | int | 班级编号,主键 |
c_name | nvarchar(10) | 班级名称 |
Course表
列 | 类型 | 说明 |
---|---|---|
c_id | int | 课程编号,主键 |
c_name | nvarchar(10) | 课程名称 |
c_emphasis | bit | 是否核心课程 |
c_type | nvarchar(10) | 课程类型 |
c_credit | int | 课程学分 |
c_theoryTime | int | 理论学时 |
c_practiceTime | int | 实践学时 |
c_methods | nchar(2) | 考核方式 |
CourseCategory表
列 | 类型 | 说明 |
---|---|---|
c_id | int | 课程类型编号,主键 |
c_name | nvarchar(10) | 课程类型名称 |
c_property | nvarchar(10) | 课程类型分类名称 |
c_credit | int | 课程类型学分 |
c_time | int | 课程类型学时 |
c_remarks | nvarchar(50) | 备注 |
Student {
s_id int primary key,
s_name nvarchar(10) not null,
s_sex nchar(1) not null check(s_sex=’男’ or s_sex=’女’),
s_address nvarchar(50),
s_credit int default(0),
s_time date default(getDate()),
}
Teacher {
t_id int primary key,
t_name nchar(10) not null,
t_sex nvarchar(1) not null check(s_sex=’男’ or s_sex=’女’),
}
Department {
d_id int primary key,
d_name nvarchar(10) not null
}
Specialty {
s_id int primary key,
s_name nvarchar(10) not null,
}
Class {
c_id int primary key,
c_name nvarchar(10) not null,
}
Course {
c_id int primary key,
c_name nvarchar(10) not null,
c_emphasis bit not null default(0),
c_type nvarchar(10) not null,
c_credit int not null,
c_theoryTime int,
c_methods nchar(2) not null check(s_methods = ’考试’ or s_methods = ‘考查’),
c_practiceTime int,
}
CourseCategory {
c_id int primary key,
c_name nvarchar(10) not null,
c_property nvarchar(10) not null,
c_credit int not null,
c_time int,
c_remarks nvarchar(50)
}
(4) 绘出E-R图:
2、向老师核实的问题:
(1) 一种课程是只有一个教师还是多个教师?
答:一种课程有多个教师。
(2) 某一门课程是否一定有学生?
答:课程刚开设时没有学生,或者选修课程没有学生选报。
(3) 老师可以没课吗?
答:老师可以没课。
写于2013-04-09 23:30