如何检查 Oracle 中关系的模态/基数
我正在尝试对 Oracle 中的数据库进行逆向工程。我已经能够找到与外键相对应的主键和引用完整性规则,但无法找到模态/基数规则的存储位置。
任何有关查看哪个表或示例查询的帮助将不胜感激。
I am attempting to reverse engineer a Database that is in Oracle. I have been able to find the main keys and the referential integrity rules that correspond to the Foreign Keys but cannot locate where the modality/cardinality rules are stored.
Any help regarding to which table to look in or a sample query would be greatly appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
模态/基数规则是什么意思?
对于 Oracle 而言,FK 关系始终是 1:N。我想可以通过在同一字段上但方向相反的两个 FK 关系来强制执行 1:1。
关于基数的唯一其他“规则”是唯一键,但我认为您已经拥有了这些。如果没有,这可能会有所帮助:
http://www.eveandersson.com /writing/data-model-reverse-engineering#constraints
根据数据库的设置,您还可能会发现有关列中值基数的启发式:
尤其是值“NUM_DISTINCT”可能会有一定的价值。
如果您正在数据字典中寻找更多信息,我建议初学者选择此选项
What do you mean by modality / cardinality rules?
FK relationships are always 1:N as far as Oracle is concerned. I guess one could enforce a 1:1 by having two FK relationships on the same fields but in opposite directions.
The only other 'rule' concerning cardinality are unique keys, but I think you already have those. If not, this might help:
http://www.eveandersson.com/writing/data-model-reverse-engineering#constraints
Depending on the setup of the database you also might find heuristics about the cardinality of values in columns:
Especially the value 'NUM_DISTINCT' might be of some value.
If you are looking for more information in the data dictionary, I recommend this select for starters
我认为您必须检查引用列是否可以为空:
以及引用列上的唯一索引:
I think you will have to check for referring columns being
nullable
:and for unique indices on referring columns: