PostgreSQL Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesPostgreSQL Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old December 23rd, 2001, 07:35 AM
x-social x-social is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Sweden
Posts: 4 x-social User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to x-social
Question DB Design Issue?!

Hi to ya all!!!

This is my first post to this forum and Im a total newbie to PostgreSQL and DBs in general ...

Im trying to create a DB for my work wich will handle some stuff that we sell ... the problem Im having is that we have both internal and exeternal customers and I dont know how to reflect this in the DB design. For the internal customers we got a couple of master departments and some department under that.

For the external customers I just want to reference to the companies name.

But in the end I would like to have one big Customer table that I can refer to when adding a buy.

The columns that are relevant for both the custom categories are the following:

user_ID
username
password
first_name
last_name
e-mail
phone
mobile

The columns that defer for the two customer categories are the following

master_dep |____ These are for the internal customers
child_dep | A user can be memeber of say social/family

Note that both columns are are alway relevant for the interna customer.

For the external customer only one column identifies it memebership.

company

Well, hope I have made this clear how it works and what I need to get done ... any help is welcome

/Roger

Reply With Quote
  #2  
Old December 23rd, 2001, 07:12 PM
x-social x-social is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Sweden
Posts: 4 x-social User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to x-social
Cool Think I solved it today =)

Im putting all my customers into one table ... if both organization and suborganization got values, its an internal user, if only organization got a value, and sub org. is NULL its a external user.

Hope this will work =)

/Roger

Reply With Quote
  #3  
Old January 22nd, 2002, 05:12 PM
rycamor rycamor is offline
Gödelian monster
Dev Shed Regular (2000 - 2499 posts)
 
Join Date: Jul 1999
Location: Pembroke Pines, Florida, USA
Posts: 2,300 rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level)rycamor User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 3 Days 3 h 12 m 27 sec
Reputation Power: 53
Yes, you're going in the right direction. It's always best to generalize and abstract your information. If you separated your customers into two tables, you would be setting yourself up for unforseen problems later.

It sounds like you need to spend a little more time thinking about your table layout, though. It might be better for you to have yet a third table which identifies parent-child relationships between customer records. The basic rule of thumb for normalization is to not have a column in your table which will be unnecessary for a significant number of records.

Also, If your existing data isn't enough to properly separate your internal and external customers, you could just include a simple column called 'cust_type' or something like that. This would allow you to have more customer types in the future. You should include an external validation table called 'cust_types', which lists the possible customer types, and which you can use as the drop-down box for data entry. This keeps you from having incorrect information placed in that column.

If you don't catch my drift, let me know, and I will explain these ideas in more detail.

I will also recommend a couple of good books, like I did in a previous post:

"Database Design for Mere Mortals" (this gives you a great basic approach to databases in general) and "PostgreSQL Developers Handbook".
__________________
The real n-tier system:

FreeBSD -> PostgreSQL -> [any_language] -> Apache -> Mozilla/XUL

Amazon wishlist -- rycamor (at) gmail.com

Reply With Quote
  #4  
Old January 23rd, 2002, 02:36 PM
x-social x-social is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2001
Location: Sweden
Posts: 4 x-social User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Send a message via ICQ to x-social
Thanx rycamor!!!

Thanx for the ideas ... I will consider this. As Im new to this their is a lot to know =)

/Roger

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesPostgreSQL Help > DB Design Issue?!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 6 hosted by Hostway
Stay green...Green IT