需要数据库设计方面的帮助
我目前不知道如何设计这张桌子,所以我真的很想得到一些建议。说明如下:
表将保存3个考试结果。
- 考试 A:8 门必修科目,无限选修科目。
- 考试 B:6 门必修科目,无限选修科目。
- 考试 C:1 门必修科目,4 门选修科目。
要记住的功能:
- 每个科目的结果都需要可搜索(例如:在考试 A 中查找数学 A)
- 基本总计算(例如:计算考试 A 的数学中有多少个 A)
只需插入数据我就能想到然而,当将这些功能混合在一起时,它就行不通了。
我的最后一招是使用一张表:studentid、exam、subjectcode、result。这将像可搜索和可计算一样工作,但从长远来看,我有一种非常混乱和巨大的数据库的感觉。
我目前的设计(由我的朋友提供): 每个主题及其结果都有自己的领域。它有效,但很难扩展(添加更多主题)。
有什么建议吗?
I am currently out of idea how to design this table so I would really like some suggestions. Description as follows:
Table will hold 3 exam result.
- Exam A: 8 mandatory subject with infinite optional subject.
- Exam B: 6 mandatory subject with infinite optional subject.
- Exam C: 1 mandatory subject with 4 optional subject.
Feature to keep in mind:
- Each subject's result need to be searchable (eg: Find A for Math in Exam A)
- Basic total calculation (eg: calculate how many As in Math for Exam A)
Just inserting data I would be able to think of something however when putting the features into the mix, it just won't work.
My last resort is having a single table with: studentid, exam, subjectcode, result. This will work as in searchable and calculable however I have a feeling of a very messy and huge database in the long run.
My current design (given by my friend):
Each subject and its result have its own field. It works but very hard to expand (add more subjects).
Any recommendations?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能的表结构(省略列定义):
获取考试 A 中数学的 A 数:(
我知道使用联接比联接不同表的位置更好,但我有点懒)。
主题结果可搜索...我们没有足够的信息。事实上,我的答案可能完全不对劲,但已经是我认为根据目前给定信息所能得到的最接近的答案了。使某些内容可搜索只需创建一个足够有用的 select 语句即可。
Possible table structure (leaving out column definitions):
To get the number of A's for Math in Exam A:
(I know using joins would be better than where to join the different tables, but I'm being a bit lazy).
The subjects result being searchable...we don't have enough information. In fact, my answer may be completely off, but is as close as I think I can get it with the given information at the moment. Making something searchable is just a matter of creating a sufficiently useful select statment.