面向对象数据库的查询
以下是面向对象设置中数据库的方案
。每个关系都成为对象的集合。学生是一个人,教员也是一个人。这些显示为标记为“isa”的有向边。所有其他有向边均显示参考属性。请注意,Course 中的 PreReq 属性是一组引用。
这是我不知道如何编写的查询:
按 StudentID 重新组织注册集合。对于每个学生,检索学生的 ID 和成绩。 Grade 应该是由 CourseCode
和 LetterGrade
属性组成的关系。
通过重新组织,我很确定这只是意味着按该顺序检索信息,而不是对数据库进行任何更新。
The following is a scheme
for a database in an object-oriented setting. Every relation becomes a collection of objects. A Student is a person and a Faculty is also a person. These are shown as directed edges labeled "isa". All other directed edges show reference attributes. Note that PreReq attribute in Course is a set of references.
Here is the query I can't figure out how to write:
Reorganize Enrollment collection by StudentID. For each student, retrieve the student's id and a Grade. The Grade should be a relation consisting of CourseCode
and LetterGrade
attributes.
By re-organize, I am pretty sure it just means retrieve the info in that order, and NOT do any updates to the database.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
因为并非所有字段都被正确引用,并且说明有点……好吧,缺乏,我将做出一些假设。即:
学生表有一个名为“StudentID”的字段,它与 Person 表中的 ID 字段是 1 对 1 的关系。
“重新组织”的意思是“选择”......奇怪的措辞。
除了 Person 表之外,所有其他 ID 都遵循正常的命名约定。意思是,
Id
。例如,学生表中的主 ID 是 StudentID问题中的“LetterGrade”实际上指的是注册表中的“Grade”字段。
所有以“Info”结尾的字段都是以“Id”结尾的等效字段的外键。例如: Enrollment.StudentInfo 映射到 Student.StudentId
类似的东西
Because not all of the fields are properly referenced and the instructions are a bit... well, lacking, I'm going to make a few assumptions. Namely:
The student table has a field called "StudentID" which is a 1 to 1 relationship with the ID field in the Person table.
"Reorganize" means "select".. Odd phrasing that.
Other than the Person table, all other IDs follow normal naming conventions. Meaning,
<TableName>Id
. For example, the primary ID in the student table is StudentID"LetterGrade" in the question actually refers to the "Grade" field in the enrollment table.
All fields ending in the word "Info" are foreign keys to the equivalent field ending in "Id". For example: Enrollment.StudentInfo maps to Student.StudentId
Something along the lines of