Re: Help! I can't support normalization

From: Vadim Tropashko <vadim.tropashko_at_oracle.com>
Date: Fri, 15 Nov 2002 11:16:09 -0800
Message-ID: <3DD547F9.B10179D4_at_oracle.com>


Paul wrote:

> mikharakiri_at_yahoo.com (Mikito Harakiri) wrote in message news:<bdf69bdf.0211081037.358377d3_at_posting.google.com>...
> > "Paul Vernon" <paul.vernon_at_ukk.ibmm.comm> wrote in message news:<aqe3e2$ne8$1_at_sp15at20.hursley.ibm.com>...
> > > "Paul" <pbrazier_at_cosmos-uk.co.uk> wrote in message
> > > news:51d64140.0211070129.6fab7168_at_posting.google.com...
> > > > OK then, what about complex numbers?
> > > >
> > > > Logically they are one "thing" so should you store them as "3+4i" in
> > > > one column?
> > > > Or as real part and imaginary part in two columns?
> > > > Or even in two columns r, theta where z = r * e ^ theta?
> > > > It's only for our convenience that we split them into two parts, the
> > > > complex numbers with integer (real, imaginary) parts are countable so
> > > > we could easily map them one to one with the integers.
> > >
> > > Don't confuse possible representations (read D&D) from the actual values
> > > themselves.
> >
> > The question is if a representation spanning into 2 columns is
> > legitimate.

>

> The other thing is storing points (or vectors) in a standard
> n-dimensional space e.g. (1,2,3) in three-dimensions. You might think
> that it should be in three separate columns. But supposing you wanted
> to define various operators like dot product or cross product it would
> be nice to only have to do it once (in your domain definition).

For n-dimensional vector there is one more possibility:

table vector (

    name varchar2,
    component# integer,
    value number
)

Cross product is just an aggregate operation

select '<A,B>' as name, sum(a.value*b.value) from vector.a, vector.b where a.name = 'A' and b.name = 'B'
and a.component# = b.component#

Therefore, for complex structures our options are:

1. 1 row, multiple columns of primitive values
2. 1 row, 1 column, 1 composite object value
3. 1 type tag column (aka component#) + 1 primitive value, multiple rows

In the other thread there was an example of pivoting transformation between representations #1 and #2

> It does look strange having (1,2,3) in one column of your relation
> tuple. But really it's just notation, you could write "(1,2,3)" as
> "foobar" if you wanted.
> You could think of it as a meaningless (to the RDBMS) string "(1,2,3)"
> that is sent to a "domain parser" whenever you need to perform some
> operation on it.

Composite values, can also be thought as generalized aggregates. Suppose we have a concatenation aggregate function. Then, your string "(1,2,3)" is essentially

select '(' || concat( value||',') || ')' from vector where name = 'A'

(if we ignore subtleties like ordering and extra trailing ',' character).

> I can't off-hand think of any non-mathematical examples of this, maybe
> because non-mathematical domains tend to be fairly unstructured and
> don't have useful operators defined on them. But I'm sure there must
> be examples so I'll have a think.

Ironically, object people think that all our world is filled with objects, which are supposed to be fairly structured, or, at least, do have useful operations. Airplan.fly()? Received on Fri Nov 15 2002 - 20:16:09 CET

Original text of this message