Jared,

Yeah, It may be just a design issue but not quite sure.

I was referencing from a document "Data Modeling: It's Really All About the
Relationships" by Dr. Bert Scalzo of Quest Software.
Data modeling is part of the conceptual design phase. When speaking of the
E-R methodology, the data model produces 1. E-R diagram which represents
the data structures in some type of graphical form.
The second component is the data document which details the data objects,
relationships, and database rules. Here is where I think it could be argued
both a modeling/design issue.  I certainly see some merit in your
reasoning. I agree the use of surrogate keys
would prevent this. I do not know why this was not mentioned by the author.

Rick




                                                                                       
               
                    Jared.Still@ra                                                     
               
                    disys.com            To:     Multiple recipients of list ORACLE-L  
               
                    Sent by:              <[EMAIL PROTECTED]>                       
               
                    [EMAIL PROTECTED]       cc:                                           
               
                    om                   Subject:     Re: Data modeling question       
               
                                                                                       
               
                                                                                       
               
                    10/30/2002                                                         
               
                    01:05 PM                                                           
               
                    Please respond                                                     
               
                    to ORACLE-L                                                        
               
                                                                                       
               
                                                                                       
               




Rick,

This doesn't actually have anything to do with data modeling,
but rather, database design.

The FK can't be enforced on a multipart key if one of the columns
is null, obviously.  At least, I *think* it's obvious.

What happen when you try to update column b in table 2 with
a valid value?

with and invalid value?

There's a good case here for using surrogate keys, as always.

That way, invalid values cannot be put in an FK column, since there
is only one column needed to reference the foreign PK.

Jared






[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
 10/30/2002 08:08 AM
 Please respond to ORACLE-L


        To:     Multiple recipients of list ORACLE-L <[EMAIL PROTECTED]>
        cc:
        Subject:        Data modeling question


I was reading one of the papers on the quest website about data modeling.
An example was presented and I did not believe the
results so I tried it out. Of course the writer ( Phd) was correct.

Does anyone know why does not enforce RI constraint if any of the foreign
key colums are NULL.  I took it literally that if I insert any
record in table_2 that a corresponding record must be in the
parent(table_1). Apparently this is not so.
Someone please explain.

Thanks
Rick

drop table table_2;
drop table table_1;

create table table_1 (
  a number not null,
  b number not null,
  c number,
 constraint table_1_pk primary key (a,b));


create table table_2 (
a number,
b number,
d number not null,
e number not null,
f number,
constraint pk_table_2 primary key (d,e),
constraint fk_table_2_reference_table_1 foreign key (a,b)
references table_1 (a,b))
/

insert into table_2 values(1,NULL,3,4,5);

1 row processed.


--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).



--
Please see the official ORACLE-L FAQ: http://www.orafaq.com
--
Author:
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).




-- 
Please see the official ORACLE-L FAQ: http://www.orafaq.com
-- 
Author: 
  INET: [EMAIL PROTECTED]

Fat City Network Services    -- 858-538-5051 http://www.fatcity.com
San Diego, California        -- Mailing list and web hosting services
---------------------------------------------------------------------
To REMOVE yourself from this mailing list, send an E-Mail message
to: [EMAIL PROTECTED] (note EXACT spelling of 'ListGuru') and in
the message BODY, include a line containing: UNSUB ORACLE-L
(or the name of mailing list you want to be removed from).  You may
also send the HELP command for other information (like subscribing).

Reply via email to