I am creating system for a school management system and come up with the attached database schema.
我正在为学校管理系统创建系统,并提出附加的数据库模式。
Database diagram http://oi40.tinypic.com/15x21ig.jpg
http://oi40.tinypic.com/15x21ig.jpg数据库关系图
Following is how the system works:
以下是该系统的工作原理:
- A school has many students and teachers. It has also many courses(subjects) taught. A grade level can have many courses assigned. These courses in turn will be assigned to the students in that particular grade.
- 一所学校有许多学生和老师。它还有许多课程(科目)。一个年级可以分配许多课程。这些课程将依次分配给该年级的学生。
- The levels of students are categorized into grades and sections. A student can be in Grade 5, but if grade 5 students are huge in number, they are divided into sections. eg: Grade 5 section A, Grade 5 section B.
- 学生的水平被分为年级和组。一个学生可以在五年级,但是如果五年级的学生人数很多,他们就会被分成几个部分。五年级A组,五年级B组。
- Students are placed in unique classrooms. A classroom will be unique throughout. Classroom of Grade 5 Section A of year 2010 will be different from Classroom of Grade 5 Section A of year 2011.
- 学生被安置在独特的教室里。教室将是独一无二的。2010年度五年级A组的教室与2011年度五年级A组的教室不同。
- Students are assigned parents. A parent can have more than one student in the school.
- 学生的父母。父母在学校里可以有一个以上的学生。
- One or more classrooms can be assigned to a teacher.
- 一个或多个教室可以分配给老师。
- Attendance for students are taken by their teacher on a daily basis
- 学生每天的出勤由老师负责
- There will be many types of exams. Exam results are stored for each subject (course).
- 考试的种类很多。每个科目(课程)都有考试成绩。
I am a beginner in database normalization and would be glad if anyone could give me some hints if the database looks alright or not.
我是一个数据库规范化的初学者,如果有人能给我一些提示,如果数据库看起来还好或者不好,我将很高兴。
EDIT:
编辑:
Also, there will only be one point of login. In the above case, during login, a user will have to select the type of user from a dropdown list. That dropdown selection will be used to query to respective table to login to the system. Another alternative is to use a common user
table, which will store the user_id, email, password, last_login_date, last_login_ip
but will store other details in respective tables such as student, parent, teacher
. So, what is the preferred/correct way to implement it?
此外,只有一个登录点。在上述情况下,在登录期间,用户必须从下拉列表中选择用户类型。下拉选择将用于查询到相应的表以登录到系统。另一种选择是使用一个通用的用户表,该表将存储user_id、电子邮件、密码、last_login_date、last_login_ip,但将在相应的表中存储其他细节,如student、parent、teacher。那么,实现它的首选/正确方法是什么?
1 个解决方案
#1
5
You don't model GRADE_SECTIONS at all.
你根本不需要建模。
Unless your school has a massive programmr of demolition and construction every summer holiday the classrooms will be the same. It is the assignments which change each year. So CLASSROOMS should be assigned to a separate GRADE_SECTION entity, instead of merging SECTIONS and CLASSROOMS as you do now.
除非你们学校每年暑假都有大规模的拆迁和建设项目,否则教室还是一样的。这是每年变化的任务。因此,教室应该被分配给一个单独的GRADE_SECTION实体,而不是像现在这样合并各个部分和教室。
Students should be assigned to GRADE_SECTIONS not CLASSROOMS.
学生应该被分配到年级组而不是教室。
COURSES should have many EXAMS rather than many EXAM_RESULTS. It simply doesn't make sense that a French Exam could be taken by students learning Maths and Russian.
课程应该有许多考试而不是许多考试成绩。学习数学和俄语的学生参加法语考试是毫无意义的。
#1
5
You don't model GRADE_SECTIONS at all.
你根本不需要建模。
Unless your school has a massive programmr of demolition and construction every summer holiday the classrooms will be the same. It is the assignments which change each year. So CLASSROOMS should be assigned to a separate GRADE_SECTION entity, instead of merging SECTIONS and CLASSROOMS as you do now.
除非你们学校每年暑假都有大规模的拆迁和建设项目,否则教室还是一样的。这是每年变化的任务。因此,教室应该被分配给一个单独的GRADE_SECTION实体,而不是像现在这样合并各个部分和教室。
Students should be assigned to GRADE_SECTIONS not CLASSROOMS.
学生应该被分配到年级组而不是教室。
COURSES should have many EXAMS rather than many EXAM_RESULTS. It simply doesn't make sense that a French Exam could be taken by students learning Maths and Russian.
课程应该有许多考试而不是许多考试成绩。学习数学和俄语的学生参加法语考试是毫无意义的。