Non-relational database model [message #205098] |
Thu, 23 November 2006 05:26 |
davidleigh
Messages: 1 Registered: November 2006 Location: UK
|
Junior Member |
|
|
I have an oracle (now 10.2 - originally 7.34) database where a lot of the joins are implemented by a flag and key method, i.e. the join columns are "Tablename Indicator", "Primary Key value". I would like an explanation of why this method should NOT be used (or am I wrong and this sort of model is a good idea).
Either a message (preferred) or pointer to a good publication would be very welcome.
Thanks.
|
|
|
Re: Non-relational database model [message #329842 is a reply to message #205098] |
Thu, 26 June 2008 13:04 |
hhelgen
Messages: 12 Registered: April 2007 Location: Duluth MN
|
Junior Member |
|
|
If I understand you correctly, the system uses the value of data in columns to determine the related table. For a legacy system, business needs may require you to continue with this.
However, for new data models - this technique ignores Oracle's referential integrity constraints. These constraints are static - coded into the definition of a table. The referential integrity is coded as a foreign key. Use Oracle's built-in features as much as possible, because Oracle's constraints automatically prevent adding records without a related parent. Oracle's constraints automatically prevent deleting a parent record if it has related children. It does this natively and consistently within the database. No application coding is needed.
CONSTRAINT FK_TABLE1_TABLE2 FOREIGN KEY(TABLE2COLUMN)
REFERENCES MYSCHEMA.TABLE1(TABLE1KEY))
|
|
|