Re: simple join problem

From: "Matthew Nuzum" <cobalt(at)bearfruit(dot)org>
To: <mallah(at)trade-india(dot)com>
Cc: <pgsql-sql(at)postgresql(dot)org>
Subject: Re: simple join problem
Date: 2003-02-20 04:25:50
Message-ID: 000001c2d898$264d1650$6900a8c0@mattspc
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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(at)bearfruit(dot)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.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message jack 2003-02-20 05:45:50 problem on truncate for v.7.3.2
Previous Message mallah 2003-02-20 04:02:25 Re: simple join problem