Re: Network Example: Sibling of Opposite Gender

From: Lennart <Erik.Lennart.Jonsson_at_gmail.com>
Date: 30 Dec 2006 02:02:09 -0800
Message-ID: <1167472929.809675.281390_at_s34g2000cwa.googlegroups.com>


Tonkuma wrote:
[...]
> CREATE TABLE Sibling.person
> (name VARCHAR(7) NOT NULL
> ,gender VARCHAR(10) CONSTRAINT gender_value
> CHECK(gender IN ('male', 'female')
> OR
> gender IS NULL)
> ,father VARCHAR(7)
> ,mother VARCHAR(7)
> );
>

Minor note: "OR gender IS NULL" is not necessary. You can define the constraint gender_value as CHECK(gender IN ('male', 'female')). gender_value must not evaluate to FALSE, and in the case of null it is evaluated to null, which is - sort of - ok.

/Lennart Received on Sat Dec 30 2006 - 11:02:09 CET

Original text of this message