Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.server -> Enforcement of 1 to many
Hi Cliff,
Closest, I can think of enforcing this within database is the rule that
"every DEPARTMENT must HAVE a MANAGER".
This rule is in the context of typical DEPARTMENT - EMPLOYEE tables
relation.
Every EMPLOYEE must belong to one and only DEPARTMENT. An EMPLOYEE could
be a MANAGER.
If we make the MANAGER (FK) in the DEPARTMENT table NOT NULLable, The
database will enforce that at least one employee must be identified for
defining a department.
The only restriction in this approach that comes to mind is, we should be able to identify that one "special KID". It is artificial solution. (But, I have problem with the PARTIALITY).
Hope this helps !
Sudhakar Balasankar
IS Consultant
mailto:sudhakar_at_tsp-inc.com
Phone(888)-332-6602
Fax (888)-332-6603
> -----Original Message-----
> From: Clifford Buetikofer [SMTP:clifford_buetikofer_at_merck.com]
> Posted At: Tuesday, April 27, 1999 9:11 AM
> Posted To: server
> Conversation: Enforcement of 1 to many
> Subject: Enforcement of 1 to many
>
> Gurus,
>
> I need to enforce a 1 ( mandatory ) to many relationship between 2
> tables. Can the database do this or should we control it at the
> application level ? We do have a FK on the child table but how do we
> enforce ALL parents to have at least 1 child ? Procedurally ?
>
>
> TIA,
> Cliff
> ( I have 2 kids so I'm covered )
>
>
> The contents of this message express only the sender's opinion.
> This message does not necessarily reflect the policy or views
> of
> my employer, Merck & Co., Inc. All responsibility for the
> statements
> made in this Usenet posting resides solely and completely with
> the
> sender.
Received on Tue Apr 27 1999 - 12:12:08 CDT