If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > General > Database Concepts & Design > Tiger Furniture company!!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #16 (permalink)  
Old 09-18-08, 12:35
kristofer kristofer is offline
Registered User
 
Join Date: Sep 2008
Posts: 32
Quote:
Originally Posted by r937
you should try to do your ERD without resorting to surrogate "id" keys

but perhaps your teacher will overlook this problem
Why is that? I've always been told that surrogate keys is best practise when it comes to designing databases. Natural keys are open to change and with surrogate keys you cut out some of the work with normalization (once you have 1NF you also have 2NF). Besides, it's basically spelled out in the assignment that they're supposed to use customer_ID as a primary key for Customers.
Reply With Quote
  #17 (permalink)  
Old 09-18-08, 12:44
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
surrogate keys are fine, if you need them, and if they're appropriate, but only in the physical modelling stage of development

in the logical modelling stage (which is what ERDs are all about), you must use natural keys

any table with only a surrogate key, and no natural keys, is a disaster waiting to happen...
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #18 (permalink)  
Old 09-18-08, 13:15
Pearl_89 Pearl_89 is offline
Registered User
 
Join Date: Sep 2008
Posts: 24
Are you sure the E-R diagram right?? Mine didnt have that much table...
like I didnt do the Company and branch table .....
Reply With Quote
  #19 (permalink)  
Old 09-18-08, 13:27
psss psss is offline
Registered User
 
Join Date: Sep 2008
Posts: 38
Iam not sure about mine, i think company and branch are not needed. it just shows relation between branches and sales person.
Reply With Quote
  #20 (permalink)  
Old 09-18-08, 13:32
Pearl_89 Pearl_89 is offline
Registered User
 
Join Date: Sep 2008
Posts: 24
I only did 7 tables......I dont get how you did yours.!
1-Product
2-Customer
3-Order
4-Saleperson
5-Territories
6-Material
7-Vendor
Reply With Quote
  #21 (permalink)  
Old 09-18-08, 13:36
psss psss is offline
Registered User
 
Join Date: Sep 2008
Posts: 38
ok, Dont worry about tables, check whether the diagram meets all the requirements.
y dont u post ur ERD so that others can tell u how far ur ERD is correct!!
Jus an advice!!
Reply With Quote
  #22 (permalink)  
Old 09-18-08, 14:39
kristofer kristofer is offline
Registered User
 
Join Date: Sep 2008
Posts: 32
Quote:
Originally Posted by r937
in the logical modelling stage (which is what ERDs are all about), you must use natural keys
I'm a bit confused here. I've always looked upon the design diagram as the logical design and the actual creation of the tables (via sql statements) as the physical design and nothing of what I've been told so far prevents you from using surrogate keys in the design model if you so wish. The one course I had in college taught us to look for natural keys as an exercise but then went on to say that surrogate keys was the better choice 9 times out of 10.

Quote:
Originally Posted by r937
any table with only a surrogate key, and no natural keys, is a disaster waiting to happen...
Isn't the Address-table a good example of such a table and isn't that a pretty common occurrence in a db?
Reply With Quote
  #23 (permalink)  
Old 09-18-08, 15:00
r937 r937 is offline
SQL Consultant
 
Join Date: Apr 2002
Location: Toronto, Canada
Posts: 19,524
surely the course made a distinction between logical and physical design?

ERDs are logical, i.e. no surrogate keys

it doesn't matter if you eventually end up using surrogate keys "9 times out of 10" in your physical tables

natural keys are not "an exercise"

they are a crucial part of proper logical design

if you fail to declare UNIQUE constraints in addition to your surrogate keys, you're going to be S.O.L. at some point
__________________
r937.com | rudy.ca
please visit Simply SQL and buy my book
Reply With Quote
  #24 (permalink)  
Old 09-18-08, 15:15
kristofer kristofer is offline
Registered User
 
Join Date: Sep 2008
Posts: 32
I wonder if I've got the definition of ERD wrong? The diagram that I'm working on (attached) is what I would refer to as a ERD. We also used to draw something called an Class Diagram in the inception phase were we just modelled entities in UML using Rational Rose, could this be what you're talking about?

It's particularly confusing when you read articles that say stuff like:
Quote:
Data modelers (for this discussion, I include anyone who has designed tables for a database) are divided on this question: Some modelers swear by the surrogate key; others would die before they used anything but a natural key. A search of the literature about data modeling and database design supports neither side except in the data warehouse arena, in which a surrogate key is the only choice for both dimension and fact tables. That lack of consensus leaves those of us in the transactional database world to wrestle with the question of which key makes a better primary key—a natural key or a surrogate key. The ultimate answer is a resounding "It depends." Whether you choose a surrogate key or a natural key depends on your data, your database platform, and the group that wields more power in your organization—the DBA group or the applications development team.
Attached Thumbnails
Tiger Furniture company!!-ienotation.jpg  

Last edited by kristofer; 09-18-08 at 15:34.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On