Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
A person is a person unless they are a company
Old 01-15-2012, 12:49 AM A person is a person unless they are a company
Extreme Talker

Posts: 175
Trades: 0
I once read that when making a database, rather than splitting up say employees from family into two different table, all are considered people and therefore all people should be put in one table where you then reference back to the table to associate the relations of husband and wife or children.

I am now looking at a database that I want to include companies with the address and phone numbers. I am wondering if it does not make sense than to just say all people and companies are Entities therefore should I just be putting in one table for all Entities. Sort of like the government in the sense that we all pay taxes regardless of whether we are a person or a company.

Part of the reason for asking is, I am trying to create a table with addresses but seems silly to create two tables, one for people and one for companies. So, I am thinking that I should have one table for address but how to deal with two separate table...one for people and one for companies.

Thoughts?
dgkindy is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-15-2012, 08:16 AM Re: A person is a person unless they are a company
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Whenever you are likely to have duplicated fields or data it is better for writing queries and storage space to combine the data into a single structure.

When you are developing a database schema you have to "divorce" yourself from the real world and simply consider the abstract where everything is a "object" with "attributes" .

As "people" and "companies" have many common attributes, names, addresses, contact details etc. You should simply consider them ALL as data entities rather than the arbitrary names we give to everything to identify them.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Old 01-15-2012, 08:45 AM Re: A person is a person unless they are a company
Extreme Talker

Posts: 175
Trades: 0
Agreed, so then to allow the distinction between a person and a company, simply add a field to the table that identifies what that entity is?
dgkindy is offline
Reply With Quote
View Public Profile
 
Old 01-15-2012, 10:28 AM Re: A person is a person unless they are a company
chrishirst's Avatar
Defies a Status

Posts: 43,959
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
Yep, just set a flag that indicates what the entity represents.
__________________
Chris. ->>
Please login or register to view this content. Registration is FREE
<<-

A foolish consistency is the hobgoblin of little minds
Thought for today:- Is SEO the only industry where all the cowboys are Indians?
chrishirst is online now
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to A person is a person unless they are a company
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.19722 seconds with 11 queries