× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



"MIDRANGE-L" <midrange-l-bounces@xxxxxxxxxxxx> wrote on 12/14/2016
11:15:07 AM:
Does the Customer table need to have an index that has Customergroup
as part of the key in order for me to setup a foreign key?

An index is not *required* in order to set up a foreign key
relationship. The constraint for the foreign key relationship carries an
implied index. I may not word this correctly, but, you can certainly add
a unique key constraint to the foreign key column -- which creates an
implied index, too. Here is an example from one of my tables.

Alter Table IM_LIFO_Inventory_Adjustments
Add Constraint IMLFADJT_PK
Primary Key (IMLFADJT_ID);

Label On Constraint IMLFADJT_PK
Is 'IM-LIFO Inventory-Temporary Adjustments-PK';

-------------------------------------------------
Alter Table IM_LIFO_Inventory_Adjustments
Add Constraint IMLFADJT_IM02TID_UK
Unique (IM02T_ID);

Label On Constraint IMLFADJT_IM02TID_UK
Is 'IM-LIFO Inventory-Temporary Adjustments-UK';

-------------------------------------------------
Alter Table IM_LIFO_Inventory_Adjustments
Add Constraint IMLFADJT_IM02TID_FK
Foreign Key (IM02T_ID)
References IM02T (IM02TID)
On Delete Restrict
On Update Restrict;

Label On Constraint IMLFADJT_IM02TID_FK
Is 'IM-LIFO Inventory-Temp Adjustment-IM02T-FK';

Sincerely,

Dave Clark

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.