Re: Which database design is better
From: Joe Celko (jcelko212_at_earthlink.net)
Date: 10/04/04
- Next message: Dan Guzman: "Re: How to return an output..."
- Previous message: David Browne: "Re: Which database design is better"
- In reply to: David Browne: "Re: Which database design is better"
- Next in thread: dummy_at_163.com: "Re: Which database design is better"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 04 Oct 2004 16:42:19 -0700
>> Not here. You shouldn't be using ON UPDATE CASCADE in first place,
since you shouldn't be updating primary keys. <<
Boy, are you in for a surprise when the ISBN and UPC codes go to 13
digits next year! Yes, you can update primary keys because you can
update any attribute; you just need to make sure that all references to
them are also updated.
That was a major advantage of RDBMS over old files systems; identifiers
appear in one and only place, then can be referenced from there. One
fact, one way in one place.
>> Each employee has exactly one store. Therefore store is an attribute
of employee. <<
No. An employee has a relationship with a store; a job title, a
position number, seniority, etc. If it were an attribute it would be a
scalar. Weight and height can be employee attributes; they are scalar
values. Remember that part in the specs in this thread about each store
having one and only one of a certain job title?
If you close a store the employee cannot be in that store. I cannot
close the value "150 pounds" in the domain of the weight attribute.
Very different properties between the entity "store" and the attribute
"weight".
>> That's not a principle at all. <<
Really? What are E-R diagrams based on then?
>> According to that, you could never have a FK relationsip between two
"entity tables", there would always need to be an intermediate
"relationship tables". <<
Unh? What does "between" mean? I can have a reference FROM a table TO
another table -- it is directional, not a bi-directional kind of thing
at all. I
I need to a relationship table if there is a relationship; if there is
just a reference, then I can use a REFERENCES clause.
--CELKO--
Please post DDL, so that people do not have to guess what the keys,
constraints, Declarative Referential Integrity, datatypes, etc. in your
schema are. Sample data is also a good idea, along with clear
specifications.
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
- Next message: Dan Guzman: "Re: How to return an output..."
- Previous message: David Browne: "Re: Which database design is better"
- In reply to: David Browne: "Re: Which database design is better"
- Next in thread: dummy_at_163.com: "Re: Which database design is better"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|