pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Matthew Nuzum <cobalt@bearfruit.org>
To: mallah@trade-india.com
Cc: pgsql-sql@postgresql.org
Subject: Re: simple join problem
Date: Wed, 19 Feb 2003 23:25:50 -0500
Message-ID: <000001c2d898$264d1650$6900a8c0@mattspc> (raw)
In-Reply-To: <1130.219.65.252.17.1045713745.squirrel@mail.trade-india.com>

It may not be too off topic...

This database structure allows me to have several means of contact for my
each of my customers.  An insert trigger keeps exactly one email address,
phone number and mailing address marked as the primary one for that account.
I use a view to give my easy access to the customer's primary contact
information.

Previously, I used a table structure like this:
  users
==========
 x|username
  |password
  |firstname
  |lastname
  |billing_email
  |other_email
  |phone
  |fax
  |tollfree
  |cellphone
  |pager
  |billing_address1
  |billing_address2
  |billing_address3
  |billing_town
  |billing_state
  |billing_country
  |billing_zip
  |other_address1
  |other_address2
  |other_address3
  |other_state
  |other_country
  |other_zip

As you can see, there are a lot of wasted fields.  Most of my customers have
just one address, phone number and e-mail on file however, some have
several.

By shifting to this structure, my data is more normal(ized).  There are no
limits as to the depth of contact information I can have about my customers.

--
Matthew Nuzum
www.bearfruit.org
cobalt@bearfruit.org
 
> 
> Good to see that you got the answer to ur problem.
> 
> But i have a question to u.
> 
> Why at all are you keeping 4 tables and joining them too.
> why not have a single table with all the merged columns?
> 
> In my place i too have a database stuructue similar to you but lately
> i realized the other option would have been better. becoz for every
> datamining query i am having to join multiple table which is not very
> favourable
> to performance.
> 
> i know it may not be the proper forum to discuss this.
> 
> regds
> mallah.




view thread (7+ messages)

Message-ID: <000001c2d898$264d1650$6900a8c0@mattspc>
Permalink:  ../000001c2d898$264d1650$6900a8c0@mattspc/
Also on:    postgresql.org/message-id/000001c2d898$264d1650$6900a8c0@mattspc

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: cobalt@bearfruit.org, mallah@trade-india.com
  Subject: Re: simple join problem
  In-Reply-To: <000001c2d898$264d1650$6900a8c0@mattspc>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox