数据库设计结构和复杂性

发布于 2025-01-03 05:46:03 字数 1411 浏览 1 评论 0原文

我需要你帮助我设计数据库。我正在尝试开发一个结果应用程序,教师可以通过该应用程序计算 5 个不同级别(1-5 年)的各种学生的成绩。此外,所有学生在进步过程中都必须选修一定数量的课程,并且任何学生都不会注册两次,也没有学生能够在目前或将来的水平上注册两门课程。

我的表中有以下表格:

Database: RESULTS
-----------------

Table: STUDENTS
        This takes care of the student registration validation 
        and avoiding duplication)
 - studentID
 - first_name
 - last_name
 - other_name

Table: COURSES
        This is preloaded to the database, but it can be edited 
        to suit the needs of the user
 - courseID
 - course_code
 - course_title
 - course_unit

Table: SCORES
        This takes entries from the STUDENTS and COURSES table, 
        so there wouldn't be any occurrence of a student taking 
        the same course more than once
 - scoresID
 - courseID
 - studentID
 - semesterID
 - score
 - grade
 - remarks

YEAR 表是我所担心的,它们应该是 分别适用于一年级至五年级的所有课程, 这样任何学生注册的课程都会去 进入相应的年份。

Tables: YEAR1, YEAR2, YEAR3, YEAR4, YEAR5
 - courseID
 - studentID
 - score
 - grade
 - remarks

Table: SEMESTER
        This takes care of the semester courses identity.
 - semesterID 
   (year1_semester1, year1_semester2, 
    year2_semester1, year2_semester2, 
    year3_semester1, year3_semester2, 
    year4_semester1, year4_semester2, 
    year5_semester1, year5_semester2)

在每个table中,tableID都是唯一的。

请告诉我还应该在数据库设计中添加或删除哪些内容。

I need your help with my database design. I'm trying to develop a Result Application whereby teachers will be able to compute the results of various students in 5 different levels (Year 1-5). Also all students are required to take some amount of courses as they progress, and no student will be registered twice and no student will be able to register for two courses either at there present level of in the future.

I have the following tables in my:

Database: RESULTS
-----------------

Table: STUDENTS
        This takes care of the student registration validation 
        and avoiding duplication)
 - studentID
 - first_name
 - last_name
 - other_name

Table: COURSES
        This is preloaded to the database, but it can be edited 
        to suit the needs of the user
 - courseID
 - course_code
 - course_title
 - course_unit

Table: SCORES
        This takes entries from the STUDENTS and COURSES table, 
        so there wouldn't be any occurrence of a student taking 
        the same course more than once
 - scoresID
 - courseID
 - studentID
 - semesterID
 - score
 - grade
 - remarks

The YEAR tables are what I've got concerns about, they are supposed
to be for all the courses meant for Year 1 to 5 respectively,
so that courses registered by any student will go
into the respective year.

Tables: YEAR1, YEAR2, YEAR3, YEAR4, YEAR5
 - courseID
 - studentID
 - score
 - grade
 - remarks

Table: SEMESTER
        This takes care of the semester courses identity.
 - semesterID 
   (year1_semester1, year1_semester2, 
    year2_semester1, year2_semester2, 
    year3_semester1, year3_semester2, 
    year4_semester1, year4_semester2, 
    year5_semester1, year5_semester2)

In every table, the tableID is unique.

Please tell me what else should I add to or remove from the database design.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

已下线请稍等 2025-01-10 05:46:03

STUDENTSCOURSES 正常。

对于 SCORESscodeID 可能不是必需的,因为您可以使用 courseIDstudentID 列作为复合主列关键。
关于此表的问题:学生可以参加两次考试/测试(例如第一次失败)吗?如果是,应该记录两个分数还是只记录最终分数?当前的设计不允许超过一个分数。

我不确定 SEMESTERS 表是否真的有必要。由于您不打算存储有关年份/学期对的附加信息(即仅存储年份和学期,没有描述或其他详细信息),因此您可以简单地在 SCORES 中使用两个数字列(而不是semesterID):学期。这两者都会受到检查约束; year 只允许值 1 到 5; semester 上的另一个仅允许 1 和 2。仅当您想向学期添加更多详细信息时,单独的表才有用。

YEAR1 ... YEAR5 表:我认为应该只有一个带有 year 列的表,以便您分隔年份。使用多个表来存储相同的记录结构将导致大量额外的编码。
我不确定这个/这些表是否有必要。此/这些表将存储的信息已存储在 SCORES 表中。如果您将 SCORES 表重命名为 COURSES_TAKEN 并将 scoregrade 列最初留空(以表明学生参加了课程但尚未参加考试/测试)您可以将 SCORES 和 YEARx 表的功能合二为一。

最后,您写道:“没有学生会注册两次,也没有学生能够在当前级别或将来注册两门课程”。我在职业生涯中确实学到的一件事是,“从不”和“总是”这样的词从长远来看是无效的。如果你开发了一个好的解决方案并且最终用户喜欢它,他们会想要很多新的东西并改变它;甚至是他们之前声称永远不需要的新事物和变化。因此,请始终尝试保持设计的灵活性,以便能够轻松处理任何疯狂的新请求。

Tables STUDENTS and COURSES are OK.

In case of SCORES the column scodeID is probably not necessary as you can use courseID and studentID columns as composite primary key.
A question regarding this table: will the students be able to take an exam/test twice (e.g. first failed)? If yes, should both scores be recorded or only the final score? The current design does not allow more than one score.

I am not sure if SEMESTERS table is really necessary. Since you do not plan to store additional information about a year/semester pairs (i.e. only year and semester would be stored, no description or other details), you could simply use two numeric columns in SCORES (instead of semesterID): year and semester. Both of these would have a check constraint on them; the one on yearwould allow only values 1 to 5; the other on semester would allow only 1 and 2. The separate table would be useful only if you wanted to add more details to the semesters.

The YEAR1 ... YEAR5 tables: I think there should be only one table with a year column to allow you to separate the years. Having multiple tables to store the same records structure will lead to a lot of extra coding.
And I am not sure if this/these tables is/are necessary at all. The information that this/these tables would store is already stored in the SCORES table. If you rename the SCORES table to COURSES_TAKEN and leave the score and grade columns initially empty (to show that the students took the course but do not yet take the exam/test) you can have the functionality of SCORES and YEARx tables in one.

Finally, you wrote: "no student will be registered twice and no student will be able to register for two courses either at there present level or in the future". One thing I surely learned during my career is that words like "never" and "always" are not valid in the long term. If you develop a good solution and the end users like it, they will want a lot of new things and changes it; even new things and changes of which that they previously stated that they will never need. So, always try to keep your design flexible to be able to handle any crazy new requests easily.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文