I'm doing some FK analysis of our tables by making a directed graph representing FK dependencies and then traversing the graph. In my code, I name everything using directed graph terminology, but I'd like to have something a bit more "user friendly" in the report.
In this scenario:
create table t1(a varchar2(20));
alter table t1 add constraint t1_fk foreign key(a) references t2(b);
t1.a must exist in t2.b. So, what words should I use in the blanks?
t1 is the _______ of t2.
t2 is the _______ of t1.
Many TIA!
A relational database is designed to enforce the uniqueness of primary keys by allowing only one row with a given primary key value in a table. Foreign keys. A foreign key is a column or a set of columns in a table whose values correspond to the values of the primary key in another table.
A foreign key is a column or columns of data in one table that connects to the primary key data in the original table.
Foreign keys put the “relational” in “relational database” – they help define the relationship between tables. They allow developers to maintain referential integrity across their database.
A foreign key can reference any field defined as unique. If that unique field is itself defined as a foreign key, it makes no difference. A foreign key is just to enforce referential integrity. Making a field a foreign key doesn't change the field itself in any way.
I'd say (things between brackets are optional, but I'd use them)
[Column a of] table t1 references [column b of] table t2
and
[Column b of] table t2 is referenced by [column a of] table t1
?
I'd also specify the action that happens on delete/update if any.
Column b of table t2 is referenced by column a of table t1. Deleting a record in table t2 will delete matching records on table t1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With