Database design 具有重复组的测量数据库设计
我有一个简单的调查数据库,里面有一组线性的问题。数据库设置如下Database design 具有重复组的测量数据库设计,database-design,conditional,conditional-statements,survey,repeat,Database Design,Conditional,Conditional Statements,Survey,Repeat,我有一个简单的调查数据库,里面有一组线性的问题。数据库设置如下 Survey Table id: PK (other details) Question Table id: PK survey_id: FK (other details) Response Table id: PK question_id: FK (other details) 我被要求修改调查,以允许N个重复问题组。比如说 Question Rule Table id: PK question_id: FK respon
Survey Table
id: PK
(other details)
Question Table
id: PK
survey_id: FK
(other details)
Response Table
id: PK
question_id: FK
(other details)
我被要求修改调查,以允许N个重复问题组。比如说
Question Rule Table
id: PK
question_id: FK
response_validation_rule (possibly a regex pattern)
next_question_id
Question Rule Table
id: PK
question_id: FK
response_validation_rule (possibly a regex pattern)
next_question_id
这是实施重复组问题的最佳方式吗?我还猜测,数据也很难正常化。任何建议都将不胜感激。问题表中的自我多对多关系可能会有所帮助
多对多关系将一个问题与其他问题联系起来
要达到获取相关问题的标准: 如果是,请转到3 可以通过将FK从应答表添加到多对多表来完成。
大概是这样的:
我只是建议不要在相关问题表中使用代理标识符列
- 复合PK将是
{main question id,related question id,answer id}
- 检查约束将是
{main question id related question id}