对于oracle SQL,“表是参照完整性约束的父表”是什么?

时间:2021-10-02 09:15:18

I'm preparing for the Oracle 1Z0-051 exam and I read this in a question about DELETE/TRUNCATE:

我正在准备Oracle 1Z0-051考试,我在关于DELETE / TRUNCATE的问题中读到了这个:

... table that is a parent of a referential integrity constraint ...

...表是参照完整性约束的父级...

What does it mean for a table to be a "parent" of a another table that has referential integrity constraint?

表是否是具有参照完整性约束的另一个表的“父”是什么意思?

Or perhaps this is a false positive in the answer choices?

或者这可能是答案选择中的误报?

2 个解决方案

#1


3  

"parent" and "child" are commonly used when describing the two tables in a one-to-many relationship (of any kind, not just database related). A "parent" has many "children" (rows).

当以一对多关系(任何类型,不仅仅是数据库相关)描述两个表时,通常使用“父”和“子”。 “父母”有很多“孩子”(行)。

The "parent" is the table referred to in a foreign key constraint.
The "child" is the table referring to the parent in a foreign key constraint.

“父”是外键约束中引用的表。 “child”是指外键约束中的父表的表。

eg

例如

create table customer ( -- the "parent"
  id int,
  ...
  primary key (id)
)

create table cart ( -- the "child"
    id int,
    customer_id int,  -- the foreign key column
    ...
    constraint foreign key (customer_id) references customer(id)
)

#2


1  

Referential Integrity is implemented via a Foreign Key. The parent, is the table being referenced. So if I had an Employee table and a Department table, my foreign key would say the dept_id in the Employee table (child) must exist in the Department table (parent).

参照完整性通过外键实现。父,是被引用的表。因此,如果我有一个Employee表和一个Department表,我的外键会说Employee表(子)中的dept_id必须存在于Department表(parent)中。

Referential Integrity

参照完整性

#1


3  

"parent" and "child" are commonly used when describing the two tables in a one-to-many relationship (of any kind, not just database related). A "parent" has many "children" (rows).

当以一对多关系(任何类型,不仅仅是数据库相关)描述两个表时,通常使用“父”和“子”。 “父母”有很多“孩子”(行)。

The "parent" is the table referred to in a foreign key constraint.
The "child" is the table referring to the parent in a foreign key constraint.

“父”是外键约束中引用的表。 “child”是指外键约束中的父表的表。

eg

例如

create table customer ( -- the "parent"
  id int,
  ...
  primary key (id)
)

create table cart ( -- the "child"
    id int,
    customer_id int,  -- the foreign key column
    ...
    constraint foreign key (customer_id) references customer(id)
)

#2


1  

Referential Integrity is implemented via a Foreign Key. The parent, is the table being referenced. So if I had an Employee table and a Department table, my foreign key would say the dept_id in the Employee table (child) must exist in the Department table (parent).

参照完整性通过外键实现。父,是被引用的表。因此,如果我有一个Employee表和一个Department表,我的外键会说Employee表(子)中的dept_id必须存在于Department表(parent)中。

Referential Integrity

参照完整性