Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Usenet -> c.d.o.misc -> Re: can a field reference the sum of a field in another table?

Re: can a field reference the sum of a field in another table?

From: Sybrand Bakker <sybrandb_at_hccnet.nl>
Date: Mon, 02 Aug 2004 23:12:30 +0200
Message-ID: <raklg0t9tenglkb41lke6hjqk7ann3nr92@4ax.com>


On Fri, 30 Jul 2004 10:14:44 -0500, kaeli <tiny_one_at_NOSPAM.comcast.net> wrote:

>In article <2omkg0t45qhk17bkuttsrsmp2lggo963il_at_4ax.com>, sybrandb_at_hccnet.nl
>enlightened us with...
>> On Fri, 30 Jul 2004 08:09:57 -0500, kaeli
>> <tiny_one_at_NOSPAM.comcast.net> wrote:
>>
>> >Hey all,
>> >
>> >I'd like to make a table with a field that references the sum of another
>> >field in another table. I know I could use a view for this, but it would be
>> >more convenient if I could do it right in the table. Is that possible?
>>
>> If you want to violate normalization rules, and start your route to
>> hell, yes definitely.
>>
>>
>
>Would you care to elaborate please?
>
>
>
>

Your column is a calculated column. According to normalization theory, you don't store calculated expressions, you calculate them when you need them. Doing so, the result would be correct. Otherwise, you are at the whim and discipline of the developer, and you will easily run into mismatches between calculated and stored values. If a calculation takes 8 seconds to complete per record, that is a valid reason to denormalize. As your calculation is just a sum it is not.  

--
Sybrand Bakker, Senior Oracle DBA
Received on Mon Aug 02 2004 - 16:12:30 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US