...for a complete answer, sir!
---
Bruce Chitiea
SafeSectors, Inc.
909.238.9012 mobile
On 2015-12-14 18:16, A. Razzak Memon wrote:
At 08:18 PM 12/14/2015, Bruce Chitiea wrote:
Until now, I've only created Foreign Keys from referenced Primary
Keys.
Thinking of creating a Foreign Key from a referenced Unique Key. I
know
that R:BASE supports this with full referential integrity.
But are there any practical drawbacks to this arrangement?
Bruce,
Yes, you can define a FOREIGN KEY referenced to UNIQUE KEY.
A UNIQUE constraint requires that the data values in the column be
unique,
i.e, the column cannot contain duplicate values. By definition, the
column
must also be defined as NOT NULL.
A unique constraint can replace a "Require a unique value" rule.
A unique constraint also automatically builds an INDEX.
Tips:
After defining a UNIQUE constraint, delete rules and indexes that are
no
longer needed.
A FOREIGN KEY matches a defined PRIMARY KEY, i.e, the value in Foreign
Key
reference values in the Primary Key.
A PRIMARY KEY can exist without a FOREIGN KEY, but a Foreign Key cannot
exist without a Primary Key.
A FOREIGN KEY is always defined to reference Primary Key. A Foreign Key
automatically checks that the values in the Foreign Key exist in the
referenced Primary Key, Many Foreign Keys can be defined in one table,
and many Foreign Keys in different tables can reference the same
Primary
Key.
A FOREIGN KEY can have duplicate values but cannot have NULLs. The
value
in a foreign key must exist in a Primary Key and Primary Key also
prohibit
NULLs.
A FOREIGN KEY replaces a verify a value rule. An Index is automatically
built when a Foreign Key constraint is defined. Delete the rules and
indexes that are no longer necessary before defining a Foreign Key.
Hope that helps!
Very Best R:egards,
Razzak