Re: Composite keys
[prev]
[thread]
[next]
[Date index for 2005/05/04]
Hi Perrin,
On 5/4/05, Perrin Harkins <perrin@xxxx.xxx> wrote:
> On Wed, 2005-05-04 at 15:53 -0400, Kevin Old wrote:
> > I'd like to create a has_a() statement on EmpCustXref for customernum
> > AND storenum against CustStoreDetails.
>=20
> Wouldn't that be has_many()? There can be more than one
> CustStoreDetails for each storenum, right?
=20
Well, I'm not sure. There is a constraint on the Employee Customer
Xref table against the Customer Store Details Table:
alter table [employee customer xref]
add constraint [fk_employee customer xref_customer store details table]
foreign key (customernum, storenum) references [customer store details tabl=
e]
(customernum, storenum)
Basically, this ensures that the Customer and Store exist on the
Customer Store Details Table before allowing a record (which is linked
to it via the foreign key) to be inserted into Employee Customer Xref.
I guess I'm not exactly sure how I need to "link" these two tables up.
Thanks for your help,
Kevin
--=20
Kevin Old
kevinold@xxxxx.xxx