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 > Entitys or attributes?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-14-05, 21:39
madlan madlan is offline
Registered User
 
Join Date: Jan 2005
Posts: 10
Entitys or attributes?

Hi there,

I am trying to create a list of entities from some existing paper based forms.
I have made a list of what i thought was all of the entities but on further thinking they could be attributes.

for example, phone number, address, postcode i have put on my entity list but should the entity just be customer rather than the atributes?

Thanks,

madlan.
Reply With Quote
  #2 (permalink)  
Old 12-15-05, 06:34
andrewst andrewst is offline
Moderator.
 
Join Date: Sep 2002
Location: UK
Posts: 5,171
One person's entity is another person's attribute: it depends on your requirements. Take postcodes: for most requirements this is just an attribute of an address, but if you are designing a database for the Post Office they may think of it as an entity with attributes of its own (such as grid reference for example).

As a rule of thumb, if you don't have any interest in phones and postcodes per se, but just need a contact phone number and addresss for a person, then these are attributes.
__________________
Tony Andrews
http://tinyurl.com/tonyandrews
Reply With Quote
  #3 (permalink)  
Old 12-15-05, 06:58
healdem healdem is offline
Jaded Developer
 
Join Date: Nov 2004
Location: out on a limb
Posts: 9,246
Concur
But these sort of issues also arise in most db designs, for example:-

There are some designers who will contend that a person may have more than one phone number, so possibly these should be entities, I suppose it depends on your perception of the world you are trying to represent, and how open ended you think it may be. It could be a reasonable ssumption to suggest an individual has a specified limited number of contact points, say 2 tel, 1 fax 1 emal, others may contend that a person may have an open eded number and thereforeyou can't limit to an arbitary number, as there will alwasy be someone out there who breaks such rules.

There are also people who contend that the NULL value should never (or at best rarely used) as a NULL value indicates that that element should become an entity in its own right, personally I don't agree with that stance.
Reply With Quote
  #4 (permalink)  
Old 12-15-05, 07:29
madlan madlan is offline
Registered User
 
Join Date: Jan 2005
Posts: 10
Many thanks. That helps a lot.
Another small problem i have encountered is the addresses table for my customer.

Each customer can have 2 addresses, 1 billing and 1 delivery.
Now the billing address cannot be NULL but the delivery address can, or should it contain the same as the billing address if they are they same?!

As far as table layout goes, should i have 1 table with a field signifying the difference or 2 tables, one for each address with an address table linking them to the customer?

I’m sure this must have been thought out many times considering the amount of ecommerce these days but i cannot find any information on this scenario.

Thanks again for your help,

madlan.
Reply With Quote
  #5 (permalink)  
Old 12-15-05, 07:52
madlan madlan is offline
Registered User
 
Join Date: Jan 2005
Posts: 10
I have attached 2 erds of the two ways i can think of.

madlan.
Attached Images
File Type: jpg solution1.JPG (15.1 KB, 40 views)
File Type: jpg solution2.JPG (6.6 KB, 32 views)
Reply With Quote
  #6 (permalink)  
Old 12-15-05, 07:56
J Petruk J Petruk is offline
Registered User
 
Join Date: Mar 2004
Location: Toronto, ON, Canada
Posts: 513
I don't quite understand your solution #2... one address can be attached to many customers?

I did a design similar to #2. Customer has 1..N addresses with a "type" field to distinguish (as opposed to a flag - it's a bit more flexible as a "type"). In our system each customer has a Billing and Shipping address.
__________________
--
Jonathan Petruk
DB2 Database Consultant
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