English 中文(简体)
数据库设计:多功能完整性制约因素
原标题:Database design: multi-path integrity constraints

Consider the following situation: students receive grades for different topics, where n-th-year students only attend courses covering n-th-year topics. So, we get a commutative "belongs-to" square:

 Grades -----> Students
   |             |
   |             |
   v             v
 Topics -----> Levels

这就是我在该主题中的“多胎”的含义。

(1) 这种限制的技术术语是什么?

现在添加以下数据:这些专题被归类为主题,还有关于某些奶制品(学生,主题)的更多数据X,因此X基本上属于漫画产品学生x科目。 现在有以下事实:各年级总是与在X年有记录的奶制品(学生、科目)相对应,这样我们就可以将表级中学生的外国钥匙提升到指名X的外国钥匙:

 Grades -------> X -------> Students
   |             |
   |             |
   v             v
 Topics ----> Subjects

引入另一个多胎限制(但另一方面确保条件)。

(2) 对这些事情的理论观点是什么?

如果这过于模糊,请允许我将其限制在以下几个方面:

(2 ) What is the preferred design: the "disjoint" way such that the table grades has foreign keys for students and topics, or the "tight" way of referring to closer table X at the cost of introducing the constaint?

最佳回答
问题回答

我将采用以下表格设计:

a) 主题——主题

(b) 专题——所有现有专题的清单,每个专题都有FK主题

c) 学生——学生详情

(d) 学生-科目——向学生分配科目,增加元数据包括级别或班级、起算日期或结束日期(因为学生可能重复)

e) 年级——FK与学生的校对组合,加上额外的元数据、日期、职等、评论等。





相关问题
How to model a many-to-many relationship in App Engine?

I have a question regarding how to model a many-to-many relationship in App Engine: A Blogentry can have many tags, a tag can apply to many blog entries. I see a couple of scenarios: Use a Set of ...

How to emulate tagged union in a database?

What is the best way to emulate Tagged union in databases? I m talking about something like this: create table t1 { vehicle_id INTEGER NOT NULL REFERENCES car(id) OR motor(id) -- not valid ... } ...

Users asking for denormalized database

I am in the early stages of developing a database-driven system and the largest part of the system revolves around an inheritance type of relationship. There is a parent entity with about 10 columns ...

How to best implement a 1:1 relationship in a RDBMS?

Yesterday while working on a project I came up on a peculiar 1:1 relationship which left me wondering - how to best implement this (clearly, we had done it wrong :D) The idea is that there are two ...

Automatic filling entity properties

I have some type an architect(?) question I develop an application, based on Spring and Hibernate (annotated configuration) For each table in my database I added 4 fields: createdBy and modifiedBy(...

热门标签