Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> comp.databases.theory -> Re: Conditional Relationships ?

Re: Conditional Relationships ?

From: --CELKO-- <71062.1056_at_compuserve.com>
Date: 28 Dec 2002 21:11:44 -0800
Message-ID: <c0d87ec0.0212282111.35e1b34e@posting.google.com>


>> I'm curious as to how one would go about setting up and enforcing a
Conditional Relationship. <<

Try a better example; a student is either a foreign students or a domestic student. Unlike your orders and order details example, the two cases are clearly not related to each other.

In Standard SQL-92, you would use a CREATE ASSERTION statement, which is like CHECK() constraint at the schema level. Here is one way

CREATE ASSERTION StudentClassification
CHECK (((SELECT student_nbr FROM DomesticStudents

        UNION ALL 
        SELECT student_nbr FROM ForeignStudents)
        EXCEPT 
        SELECT student_nbr FROM Students) IS NULL);
Received on Sat Dec 28 2002 - 23:11:44 CST

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US