使用 DD 视图 all_constraints 检查 FK 约束是否有效

发布于 2024-12-05 10:27:52 字数 303 浏览 0 评论 0原文

我正在教授数据库课程的教授问了以下问题 - 目前我不知道从哪里开始,因为这似乎是一个不寻常的问题。

我了解外键是什么以及它们如何工作,但是我不确定如何回答以下问题:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

七度光 2024-12-12 10:27:52

首先,阅读有关 all_constraints 视图的文档

我的猜测。 。 。您的教授希望您查询 all_constraints 视图,并

  • 确定是否存在
  • 从 hi.olord
  • 到 ho 中的某些列的

引用完整性约束,此外,他希望您对在其他相关列中找到的值进行评论。我希望您对 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

  • determine whether there's a referential integrity constraint
  • from hi.olord
  • to some column in ho

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".

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文