Path: news.easynews.com!easynews!out.nntp.be!propagator-SanJose!news-in!feed.textport.net!newsranger.com!www.newsranger.com!not-for-mail
Newsgroups: comp.databases.theory
From: Mikito Harakiri <nospam@newsranger.com>
References: <RX3q7.5898$p77.20465@www.newsranger.com>
Subject: Re: date as a foreign key
Lines: 32
Message-ID: <Zg5q7.6059$p77.21018@www.newsranger.com>
X-Abuse-Info: When contacting newsranger.com regarding abuse please
X-Abuse-Info: forward the entire news article including headers or
X-Abuse-Info: else we will not be able to process your request
X-Complaints-To: abuse@newsranger.com
NNTP-Posting-Date: Wed, 19 Sep 2001 14:15:21 EDT
Organization: http://www.newsranger.com
Date: Wed, 19 Sep 2001 18:15:21 GMT
Xref: easynews comp.databases.theory:18411
X-Received-Date: Wed, 19 Sep 2001 11:15:46 MST (news.easynews.com)

In article <RX3q7.5898$p77.20465@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.




