Hi, all.
I need to enforce a one-to-many relationship on 2 tables, with a join
table.
Say the join table contains account information. It has cust_no and
acct_no. Both cust_no and acct_no are child FKs to other tables (no
nulls will exist in these columns).
Logically, one customer can have several accounts, but one account can
only belong to one customer.
It seems to me that a straightforward way to enforce a one-to-many
relationship, where one had not existed previously (ie I'm altering
existing tables rather than starting from scratch) would be to simply
put a uniqueness constraint on acct_no. I've already checked existing
data, and there are no duplicate values in the acct_no column
Assuming no additional business rules exist, is a simple uniqueness
constraint a reasonable way to enforce such a relationship?
Cheers,
BD
I need to enforce a one-to-many relationship on 2 tables, with a join
table.
Say the join table contains account information. It has cust_no and
acct_no. Both cust_no and acct_no are child FKs to other tables (no
nulls will exist in these columns).
Logically, one customer can have several accounts, but one account can
only belong to one customer.
It seems to me that a straightforward way to enforce a one-to-many
relationship, where one had not existed previously (ie I'm altering
existing tables rather than starting from scratch) would be to simply
put a uniqueness constraint on acct_no. I've already checked existing
data, and there are no duplicate values in the acct_no column
Assuming no additional business rules exist, is a simple uniqueness
constraint a reasonable way to enforce such a relationship?
Cheers,
BD
Comment