| Oracle FAQ | Your Portal to the Oracle Knowledge Grid | |
Home -> Community -> Usenet -> comp.databases.theory -> Re: O'Reilly interview with Date
Kenneth Downs wrote:
>>OK but if you have to specify the foreign key, why not just specify the >>columns in the firstplace?
Is that definitely true? I agree that there should be (or could be) a constraint for every join you might want to do, but can this be narrowed down further to a foreign key constraint?
>>What if you have a non-standard join? For example start_date and >>end_date columns and you want to join where some date is between these >>two?
So you're saying there is a kind of lop-sided "equality" defined with one operand being a date and the other an interval? And date = interval iff the date is contained within the interval?
Is it OK to define equality in a non-symmetrical and non-transitive way like this, with different types?
I agree a lot of non-standard joins are due to badly-designed schemas, but I can think of examples where you might want to define a join with a "greater than" clause - for example when joining a table to itself to get some kind of ranking number. (How many other salespersons have total sales greater than each salesperson?) I can't see how things can be designed to get around this.
Here's another possible scenario for the date range example: I might want to make one join based on the start_date only, and a different join based on the start/end interval. Maybe things starting on certain days get a price reduction or something. Should this be modelled:
Then if you wanted also a join on the end_date you'd need three columns: start_date, end_date and interval.
Paul. Received on Fri Aug 12 2005 - 09:46:05 CDT
![]() |
![]() |