Received: from localhost (maia-5.hub.org [200.46.204.182]) by postgresql.org (Postfix) with ESMTP id 0EC5A9FB20D for ; Mon, 8 Jan 2007 19:08:08 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.182]) (amavisd-new, port 10024) with ESMTP id 72400-07 for ; Mon, 8 Jan 2007 19:07:57 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from gatekeeper.daycos.com (outbound.daycos.com [204.26.70.70]) by postgresql.org (Postfix) with ESMTP id 9269C9FA6B0 for ; Mon, 8 Jan 2007 19:08:00 -0400 (AST) Received: by gatekeeper.daycos.com with Internet Mail Service (5.5.2653.19) id ; Mon, 8 Jan 2007 17:07:57 -0600 Message-ID: <031936836C46D611BB1B00508BE7345D04DC1BB5@gatekeeper.daycos.com> From: Curtis Scheer To: pgsql-sql@postgresql.org Cc: Aaron Bono Subject: Re: Table relationships Date: Mon, 8 Jan 2007 17:07:56 -0600 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2653.19) Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C73379.D51C4E90" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200701/18 X-Sequence-Number: 27170 This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C73379.D51C4E90 Content-Type: text/plain ->I hope you left out the foreign keys for simplicity. Make sure they get into your database. Yes I left out the foreign keys for simplicity -> Is there a difference between an address for the customer detail and an address for the customer? Not really an address is an address, it's a matter of specify an address for the customer master record which basically represents an entire customer while the customerdetail represents departments within that company that might be at a different address then the company's main office for instance. -> Could you add a specific address to multiple customer and/or customer detail records or is the address only assigned to one? Many addresses can belong to many customer detail records. The customermaster table should only contain one address so that should be a one to many relationship. I guess the real problem is defining which address is the "Main Office" for a given company. So maybe making different "Types" of addresses and referencing them to the customerdetail table is the best way to go? For instance CREATE TABLE customerdetail _address ( addressid int4, customerdetailid int4 addresstypeid varchar ) CREATE TABLE testing.addresstype ( addresstypeid serial NOT NULL, shortdescription varchar(15) NOT NULL, description varchar(100), CONSTRAINT pk_addresstype_shortdescription PRIMARY KEY (shortdescription) ) The only other problem I see is if a particular customer has the same address for all the departments in the company, then I guess the addressed would exist multiple times but in the customerdetail_address table but the user would only have to select that particular record rather then input the same address again. _____ From: Aaron Bono [mailto:postgresql@aranya.com] Sent: Monday, January 08, 2007 4:43 PM To: pgsql-sql@postgresql.org Subject: Fwd: [SQL] Table relationships ---------- Forwarded message ---------- From: Aaron Bono > Date: Jan 8, 2007 4:42 PM Subject: Re: [SQL] Table relationships To: Curtis Scheer > On 1/8/07, Curtis Scheer > wrote: I hope you left out the foreign keys for simplicity. Make sure they get into your database. To answer your questions, I think it prudent to ask a few to get a better understanding of the meaning of your tables: Is there a difference between an address for the customer detail and an address for the customer? Is there some kind of significance to attaching an address to the customer detail as opposed to the customer? Attaching the address to the detail gives it a customer by referencing through the detail. Could you add a specific address to multiple customer and/or customer detail records or is the address only assigned to one? What it gets down to is that you must start with the LOGICAL data model and ask yourself what are the meaning of the relationships and what relationships make sense before you get down to creating the PHYSICAL database. -- ================================================================== Aaron Bono Aranya Software Technologies, Inc. http://www.aranya.com http://codeelixir.com ================================================================== ------_=_NextPart_001_01C73379.D51C4E90 Content-Type: text/html Content-Transfer-Encoding: quoted-printable

->I hope you left out the foreign keys for simplicity.  = Make sure they get into your database.
            Yes = I left out the foreign keys for simplicity

-> Is there a difference between an address for the customer = detail and an address for the customer?

Not really an = address is an address, it’s a matter of specify an address for the customer = master record which basically represents an entire customer while the = customerdetail represents departments within that company that might be at a different = address then the company’s main office for instance. =

-> Could you add a specific address to multiple customer = and/or customer detail records or is the address only assigned to = one?

Many addresses = can belong to many customer detail records. The customermaster table should only = contain one address so that should be a one to many relationship. I guess the = real problem is defining which address is the “Main Office” for = a given company. So maybe making different “Types” of addresses and = referencing them to the customerdetail table is the best way to go?  For = instance

 

=

CREATE TABLE customerdetail _address

(<= /p>

addressid int4, 
customerdetailid int4
addresstypeid varchar

) =

CREATE TABLE = testing.addresstype

(

  addresstypeid serial NOT = NULL,

  shortdescription = varchar(15) NOT NULL,

  description = varchar(100),

  CONSTRAINT pk_addresstype_shortdescription PRIMARY KEY = (shortdescription)

)

 

=

The only other problem I see is if = a particular customer has the same address for all the departments in the company, = then I guess the addressed would exist multiple times but in the customerdetail_address table but the user would only have to select = that particular record rather then input the same address = again.


From: = Aaron Bono [mailto:postgresql@aranya.com]
Sent: Monday, January = 08, 2007 4:43 PM
To: pgsql-sql@postgresql.org
Subject: Fwd: [SQL] = Table relationships

 

---------- = Forwarded message ----------
From: Aaron Bono <postgresql@aranya.com>
Date: Jan 8, 2007 4:42 PM
Subject: Re: [SQL] Table = relationships
To: Curtis = Scheer <Curtis@daycos.com><= /o:p>

On 1/8/07, Curtis Scheer = <Curtis@daycos.com> = wrote:


I hope you left out the foreign keys = for simplicity.  Make sure they get into your database.

To answer your questions, I think it prudent to ask a few to get a = better understanding of the meaning of your tables:

Is there a difference between an address for the customer detail and an = address for the customer?

Is there some kind of significance to attaching an address to the = customer detail as opposed to the customer?  Attaching the address to the = detail gives it a customer by referencing through the detail.

Could you add a specific address to multiple customer and/or customer = detail records or is the address only assigned to one?

What it gets down to is that you must start with the LOGICAL data model = and ask yourself what are the meaning of the relationships and what = relationships make sense before you get down to creating the PHYSICAL database.

--
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D    Aaron Bono
   Aranya Software Technologies, = Inc.
   http://www.aranya.com
   http://codeelixir.com
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

------_=_NextPart_001_01C73379.D51C4E90--