学校数据库模式(水平问题) [英] A School Database Schema (Level Problems)

查看:61
本文介绍了学校数据库模式(水平问题)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hello Everyone



我正在申请私立学校,到目前为止一切顺利,但我遇到了这个问题:



a学生有一个成绩,但每个成绩可能有一个或多个成绩。应用程序应该将任何成功的学生从他当前的成绩转移到下一个成绩但事实是每个成绩的可变数量为小组让我很难想出一个很好的方法来组织特定小组的学生。



i想到这个解决方案,但如果你有更好的想法,那将是很棒:



1 - 我将管理组留给我的应用程序用户(这可能会被用户遗忘)

2-I强制每个小组的MAX学生数量(这个解决方案还没有和学校讨论过)。



读你的建议会很棒。



非常感谢您的时间

解决方案

我认为你已经开始朝着错误的方向前进,只是有点不对劲;我想我知道如何解决它。



你的问题是你认为一个团体是与年级相关的实体。通过这种思考,您将极大地限制系统的灵活性,并且无法使其变得现实。事实上,一个群体是具有一定生命时间的独立单位,其等级应随着时间的推移而变化。我建议你按照创作年份确定小组,也可以是其他分类器,因为每个学年可以创建一个小组。



For例如,当一些新的学生在2013年进入学校时,这意味着您必须创建新的组,您可以通过两个键来识别。例如,您可以创建组2013-1,2013-2,2013-3等。(这里,' - '表示分隔符,而不是减号:-))。



现在,当2014学年开始时,像2013-1这样的团体仍然是2013-1(再次,2013年是团队创建的一年;为什么将当前年份存储在数据库中?:-))。你应该有一个单独的表,一个成绩表。每个组将通过外键引用成绩表的记录。因此,当一个新的学年开始时,2013-1仍然是2013-1,但最初它是参考1年级,明年它参考2年级,依此类推。当然,学生表中有外键引用该组,但不是年级,因为学生的成绩将从她/他小组的当前成绩推断出来。



这应该可以解决你的争议。这种方法的应用取决于实际的教育系统,但它通常适用于大多数通用案例。甚至一个群体每年都被摧毁和重新创建,这发生在某些系统的许多学校中。您可以拥有不断增长的群组表,因为您可能需要长时间跟踪所有学生信息的历史记录。通过这种方式,2013-1,2013-2,2013-3组将始终存储为2013年创建的历史组,并于2014年或2023年关闭。它应涵盖不同学校的所有案例组织。例如,该组可以具有专业这样的属性并参考所有专业的表格,并且相同个体编号的组(在我的示例中为1,2,3等)可以表示不同的专业,但每个小组还可以参考部门(教师),它可以描述一个非常大的学校系统中的小组的功能,例如在大学的情况下。



这样,良好的抽象选择有助于保持最大程度的普遍性,同时将必要的努力保持在必要的最低限度。如果有人可以批评我的模特,我会很高兴,特别是如果这个人能建议更好的模特。



-SA

Hello Everyone

Am working on an Application for a private School, everything is going nicely so far,but i face this problem:

a student has a Grade but every Grade may have one group or more.The Application should move any succeeded student from his current Grade to the next Grade but the fact that every Grade has a variable number of Groups makes it difficult for me to think of a nice way to group students in a specific group.

i thought about this solutions but if you have any better idea that will be great:

1-I leave managing groups to the users of my application(this might be forgotten by the users)
2-I Force a MAX number of a students in every Group(this solution not discussed yet with the school).

it would be wonderful to read you suggestions.

thank you so much for your time

解决方案

I think you already started to go in wrong direction, just a bit of a wrong; and I think I know how to resolve it.

Your problem is that you think of a group as the entity related to the grade. By such thinking, you would greatly limit the flexibility of the system and cannot make it realistic. In fact, a group is the independent unit with certain life time and its grade should be changing as time passes. I suggest you to identify the group by its year of creation and may be some other classifier, as there can be more then one group created in each academic year.

For example, when some new set of student enters the school in the year of 2013, it mean that you you have to create new groups, which you can identify by two keys. For example, you can have to create groups 2013-1, 2013-2, 2013-3, etc. (Here, '-' means separator, not minus sign :-)).

Now, when 2014 academic year starts, the group like 2013-1 remains 2013-1 (again, 2013 is the year of the group creation; why storing a current year in a database? :-)). You should have a separate table, a table of grades. Each group will reference a record of a grade table by a foreign key. So, when a new academic year starts, the 2013-1 remains 2013-1, but initially it references the grade 1, and on next year it references grade 2, and so on. And of course, the table of students have the foreign key referencing the group, but not the grade, as the student's grade will be inferred from the current grade of her/his group.

This should resolve your controversy. The application of this approach depends on actual education system, but it will generally apply for most generic case. Even of a group is destroyed and re-created every year, which happens in many schools of the certain systems. You can have ever growing table of groups, because you may need to track the history of all student information for a long while. In this way, the group 2013-1, 2013-2, 2013-3 will always be stored as "historical" groups which were created in 2013 and were closed in 2014 or, say, 2023. It should cover all cases of different school organization. For example, the group can have such attribute as "specialty" and reference the table of all specialties, and the groups of the same individual number (1, 2, 3, etc., in my example) can represent different specialties, but each group can also reference department (faculty), which could describe the functioning of groups in a really big school system, such as in case of universities.

This way, the good choice of abstraction helps to keep maximum level of universality while keeping required efforts to necessary minimum. If someone can arguably criticize my model, I would be quite glad, especially if this person can advise a better one.

—SA


这篇关于学校数据库模式(水平问题)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆