使用 DD 视图 all_constraints 检查 FK 约束是否有效
我正在教授数据库课程的教授问了以下问题 - 目前我不知道从哪里开始,因为这似乎是一个不寻常的问题。
我了解外键是什么以及它们如何工作,但是我不确定如何回答以下问题:
ho 和 hi 是 BLURP 模式拥有的两个表的公共同义词。在DD视图all_constraints上执行一次查询(即使嵌套也可以认为是“一次”查询),并讨论表hi当前是否满足列hi.olord的FK约束。
每一列都有相同的值类型 CHAR(6)
& NOT NULL
约束。
任何帮助将不胜感激。
My professor whom is teaching a database course asked the following question - currently I have no idea where to start as this seems like an unusual question to ask.
I understand what foreign keys are and how they work, however I am not sure how to answer the below question:
ho and hi are public synonyms for two tables owned by the BLURP schema. Execute one query (even if nested, it can be considered as "one" query) on DD view all_constraints, and discuss whether or not table hi currently satisfies an FK constraint on column hi.olord.
Each column has identical value type CHAR(6)
& NOT NULL
constraint.
Any help would be appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
首先,阅读有关 all_constraints 视图的文档 。
我的猜测。 。 。您的教授希望您查询 all_constraints 视图,并
引用完整性约束,此外,他希望您对在其他相关列中找到的值进行评论。我希望您对 STATUS 和 VALIDATED 等进行评论。
如果您为我工作,并且我正在对此进行测试,我希望您能够证明为什么在查询中包含某些列以及为什么忽略其他列。例如,您可以省略 SEARCH_CONDITION,因为它适用于 CHECK 约束,而不适用于引用完整性约束。您可以包括 STATUS,因为是否启用或禁用特定约束的问题与确定“表 hi 当前是否满足列 hi.olord 上的 FK 约束”相关。
First, read the documentation about the all_constraints view.
My guess . . . You professor wants you to query the all_constraints view, and
And, in addition, he expects you to comment on the values you find in other relevant columns. I'd expect you to comment on STATUS and VALIDATED, among others.
If you worked for me, and I were testing you on this, I'd expect you to be able to justify why you included some columns in your query, and why you left others out. You might omit SEARCH_CONDITION, for example, because it applies to CHECK constraints, not to referential integrity constraints. You might include STATUS, because the issue of whether a particular constraint is enabled or disabled is relevant to determining whether "table hi currently satisfies an FK constraint on column hi.olord".