Re: date as a foreign key

From: Mikito Harakiri <nospam_at_newsranger.com>
Date: Wed, 19 Sep 2001 18:15:21 GMT
Message-ID: <Zg5q7.6059$p77.21018_at_www.newsranger.com>


In article <RX3q7.5898$p77.20465_at_www.newsranger.com>, Aloha Kakuikanu says...
>
>I have a master
>
>table Task (
>start_date date unique key,
><parameters>
>)
>
>and a detail
>
>table TaskStatement (
>start_date date foreign key references Run.start_date,
><etc>
>)
>
>I was told that it is bad idea to use date as a foreign key, but I didn't hear a
>convincing argument.

Even though Task.start_date is a semantically valid proposition, making TaskStatement.start_date to be the same as Task.start_date is not, because your second and later statements would normally start later than the first statement and the task itself. Now if you want to change your equijoin condition into something like:

Task.start_date < TaskStatement.start_date < Task.end_date

I would ask what to do with overlapping tasks. Received on Wed Sep 19 2001 - 20:15:21 CEST

Original text of this message