Current location: Hot Scripts Forums » Other Discussions » Database » database design problems


database design problems

Reply
  #1 (permalink)  
Old 06-03-09, 10:39 PM
DimensionX DimensionX is offline
Newbie Coder
 
Join Date: May 2009
Posts: 19
Thanks: 0
Thanked 0 Times in 0 Posts
database design problems

I'm designing a database at the moment and well with access if you make a drop down box you usually put the contents of it in a separate table, does this look ok?

Client table
=========

firstName
surname
address
town
state (dropdown contents is client side)
zip
occupation
telNumber
dateStamp
referredBy (drop down, contents taken from referral table)
clientId (primary key)

Referral table
==========
referralId (primary key)
clientName (taken from client table using clientId to look up (though not sure how to do that))
clientId (foreign key)

does that look stable? I wasn't sure what to do with the relationship, I added it in because i thought it was bad form to have a form that creates a new client by looking up itself....but i'm not sure is that actually a problem or not? :S


I put the contents of the dropdown box for the state client side to ease server traffic instead of creating a table in the database since there will be quite a number of users using this and it's doubtful that there will be anymore states.

any help will definitely be appreciated
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 06-04-09, 04:57 AM
CreativeClans CreativeClans is offline
Newbie Coder
 
Join Date: Jun 2009
Posts: 12
Thanks: 0
Thanked 0 Times in 0 Posts
I don't know what database you are going to use, but a table does not contain a drop down. Populating and showing the dropdown when the user is inserting new data, has nothing to do with the database design.

If a reference is another client, then referredBy will contain a clientID, and thus becomes a foreign key to the client table itself.

A second table (Referral) is needed if a client can have more than one referral. That table will contain at least two fields:
clientID
referredBy

Together they're the primary key, and both are foreign keys to the Client table.
In this case, there will be no referredBy field in the Client table.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
[MySQL] Database design recomendation eddyvlad Database 0 05-28-09 01:54 AM
Database design & deployment - MySQL vs SQLite Sabot Database 1 06-17-07 05:15 AM
Problems lining up design in HTML Heidenreich12 HTML/XHTML/XML 11 06-05-07 09:56 PM
Database Problems staticfire PHP 21 05-22-07 03:54 PM
Relational Database Design phppick PHP 2 11-19-03 11:12 AM


All times are GMT -5. The time now is 06:59 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.