Re: Conditional Relationships ?

From: --CELKO-- <>
Date: 28 Dec 2002 21:11:44 -0800
Message-ID: <>

>> 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)
        SELECT student_nbr FROM Students) IS NULL);
Received on Sun Dec 29 2002 - 06:11:44 CET

Original text of this message