[linux-elitists] (from Pigdog) Feuerstein on Oracle
Paul J Collins
Mon Oct 23 12:07:11 PDT 2000
>>>>> "Bad" == Bad <firstname.lastname@example.org> writes:
>>>>> "PJC" == Paul J Collins <email@example.com> writes:
PJC> First normal form (1NF) is "each fact is present only once in
PJC> the database". This is a pain in the ass to do in an OODBMS
PJC> without your objects becoming uncannily relation-like.
Bad> Hmm. I'm having a hard time picturing what you mean, here. Would this
Bad> be, say, two objects (like a parent and a child) that are mutually
Bad> navigable? So "A is the parent of B" is a fact shown in both B's
Bad> parent reference and A's child reference?
Er, I don't think that's what I'm driving at.
If you have a relation like so:
Name | Address
Paul | Ireland
Evan | USA
Nick | USA
Bertie | Ireland
Then it is not 1NF, since the fact of a location's name is duplicated
all over the place. But if you replace it with two relations like
Name | Addr_id
Paul | 1
Evan | 2
Nick | 2
Bertie | 1
Addr_id | Address
1 | Ireland
2 | USA
You can then create a view based on these relations:
CREATE VIEW name_address
AS SELECT Name, Address FROM names, addresses
WHERE names.addr_id = addresses.addr_id;
which gives you a view that's much the same as your non-normalised
relation but that will remain consistent, since the underlying
relations can't help but be so (given appropirate
primary-key/foreign-key/phase-of-moon thingies, blah blah blah).
Note: I severely tested the limits of my SQL knowledge in the
construction of that query. If it's wrong, bad or stupid, let me just
say that I am not surprised.
Bad> That seems pretty valid, but I don't see a good reason that
Bad> you couldn't just yank one of the refs. Like, I'd probably
Bad> recommend doing this for regular in-memory objects, anyways.
Bad> Maybe what you're saying is that A would contain a full copy
Bad> of B, which would of course get out of synch with B. I can
Bad> see this as another valid problem, but again the answer would
Bad> be: don't do that. It's bad object design.
I don't believe that OODBMSes are a valid way to store and manipulate
data. Not that I can back this opinion up, of course.
Paul Collins - - - - http://www.sto-kerrig.org/ - - - - [ A&P,a&f ]
GPG: 0A49 49A9 2932 0EE5 89B2 9EE0 3B65 7154 8131 1BCD
``Take care to avoid the heavy stuff,
I give up, this literature is fluff.''
More information about the linux-elitists