473,386 Members | 1,668 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

What is the best practice for databases containing People and Organizations?

124 100+
I'm creating a database that will contain person records and organization records. So, I have a Person and Organization tables with a PersonId and OrganizationId pk's respectively. Both people and organizations share common attributes like address, phone numbers, etc. My question is for these attributes should I have separate tables like PersonAddress and OrgAddress or have one address table but with two fk columns: PersonId and OrganizationId where, for any given record, one of the columns will contain an id while the other remains null because each address record will only be associated with a person or organization?

I keep vacillating between the two options and am not sure which is better for optimization/normalization, although having separate tables means doubling the number of tables I'll have. Any advice/experience in this you may have is greatly appreciated. Thanks!
Jul 18 '11 #1

✓ answered by Rabbit

Since they are contextually different types of data, they should probably go into different tables. But there's no technical drawback in using one table. It's just a little more obsfucated and perhaps a little less flexible depending on how you may want to use that table in the future.

4 2088
Rabbit
12,516 Expert Mod 8TB
If a person can have many addresses, that's one additional table. The same goes for organizations. If a person can belong to multiple organizations, that's another table.
Jul 19 '11 #2
bullfrog83
124 100+
I understand that. I'm not talking about whether addresses should be in the same table as people or organizations. Addresses are going to be in a separate table because a person and an organization can have more than one address. My question is because people and organizations both have addresses, should I have two address tables - one for people (PersonAddress) and one for organizations (OrgAddress) - or just one Address table that has a PersonId and an OrganizationId columns? Which way is better? If it even matters?
Jul 19 '11 #3
Rabbit
12,516 Expert Mod 8TB
Since they are contextually different types of data, they should probably go into different tables. But there's no technical drawback in using one table. It's just a little more obsfucated and perhaps a little less flexible depending on how you may want to use that table in the future.
Jul 19 '11 #4
ck9663
2,878 Expert 2GB
Since you setup the two as a separate table, it would probably make sense to setup a different table for address as well. Otherwise, if your PK is an int with identity property set, you might have duplicate records.

Good Luck!!!

~~ CK
Jul 19 '11 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

131
by: Peter Foti | last post by:
Simple question... which is better to use for defining font sizes and why? px and em seem to be the leading candidates. I know what the general answer is going to be, but I'm hoping to ultimately...
7
by: Hostile17 | last post by:
I'm trying to arrive at a kind of "industry standard" or "best practice" approach to CSS for a policy document aimed at developers, but not necessarily very experienced developers. What does the...
17
by: | last post by:
I have an app that retrieves data from an Access database. At the moment I have the SQL string as a Const in my app. I understand this is not best practice. I don't want the user to have access to...
8
by: Fredrik Melin | last post by:
I have a "Inventory" Object that contains the product and all its fields. The problem is that I am getting soooooo many functions under main Inventory class so it becames impossible to initalize...
20
by: Keith G. Murphy | last post by:
I'm trying to get a feel for what most people are doing or consider best practice. Given a mod_perl application talking to a PostgreSQL database on the same host, where different users are...
15
by: Bob Alston | last post by:
Is it considered best practice to distribute FE databases as MDEs rather than MDBs? Without flaming me for asking the question, could someone please enumerate the key advantages? Also I like to...
2
by: RONIN | last post by:
Can you tell me what is the best practice for SQL database migration from one DB server, to another one, new DB server. The old DB server will be removed. 1. Backup from old and restore all...
7
by: Steve | last post by:
I am building an object library for tables in a database. What is the best practice for creating objects like this? For example, say I have the following tables in my database: User: - Id -...
1
by: Dammit | last post by:
Hi! My first post in this great forum. :) Here goes: I need some feedback on best practice (or just possible practice!) on creating a copy of a table from one SQLserver to another SQLserver. ...
5
by: =?Utf-8?B?QmlsbHk=?= | last post by:
asp.net 2.0 vs2005 What is best practice for exception handling on a website in vs2005? I was going to catch errors in application on_error event, log them to the event log, then send users to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.