Database Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Codewalkers ForumsOther TechnologiesDatabase 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 Codewalkers Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old July 22nd, 2003, 01:38 PM
goltar22 goltar22 is offline
Codewalkers Newbie (0 - 499 posts)
 
Join Date: Apr 2007
Posts: 2 goltar22 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
a database of databases???

Hello all,
I have a small problem thatI hope someone has some thoughts on how to fix or attack. I am new at mysql and there are still a few things I do not know how to do yet. We have a sales force in various locations accross the southeast. All sales guys log into a web server at the end of the day to get account related information. I created a mysql db for one of the sales guys so he could put his account info and other vital contact in and be able to access it anywhere. Well it worked great!!!!!Now the problem is all the other sales guys want the same thing. This is my problem,I do not thinkthat I should have to create 39 mysql databases to solve this problem. Is there a way to somehow give each sales guy a database withinthe current database??? OK I know it sounds crazy. could I create tables for each guy within a single database(these would be huge table...performance would be bad to say the least). How do I fix this...Any ideas would be appreciated. Everything is running on unix/apache.

Thanks

Reply With Quote
  #2  
Old July 22nd, 2003, 02:34 PM
Matt Matt is offline
Moderator
Codewalkers Specialist (4000 - 4499 posts)
 
Join Date: Apr 2007
Location: Florida
Posts: 4,158 Matt User rank is Private First Class (20 - 50 Reputation Level)Matt User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 h 10 m 20 sec
Reputation Power: 6
RE: a database of databases???

I would put it all in one table...and all the sales people info in another table....

Sales People Table
-------------------
salesperson_id
last_name
first_name
...any other info

Account Info Table
------------------
acct_no
salesperson_id
...other account info


A query such as:

SELECT * FROM account_info where salesperson_id = 12

is very quick no matter how many records are in the database...even millions...with an index on the salesperson_id column.

MySQL can handle hundreds of thousands and millions of rows. Just index properly and you will be fine....

Reply With Quote
  #3  
Old July 22nd, 2003, 03:29 PM
bakertrg's Avatar
bakertrg bakertrg is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Scottsdale AZ, US
Posts: 2,253 bakertrg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 45 sec
Reputation Power: 4
Send a message via Yahoo to bakertrg
RE: a database of databases???

I sort of agree with Matt, you can easily do this with one database but it might not be as simple as two tables. You want to "normalize" your data and not make replications that lead to data anomalies. You should at a minimum have 3-4 tables for this kind of database.

I would reccomend the following 4 tables

salesperson (this has your sales force and all the information you need that is related to the employee)
client (the company, address etc. any info specific to the client)
contact (people at the client company - phone, e-mail etc.)
order (products, salespersonid, clientid, contactid, comments and special instructions)

you might also want to add a table with your products.

By normalizing your data you tighten your database considerably and prevent insertion and deletion anomalies. If you don't understand normalization and data anomalies I am pretty sure you could find several tutorials on google.

You might ask why not combine the contact info with the company info but in reality some companies will have 1 point of contact and others will have a dozen or more, no sense putting 5-10 fields for each possible contact in the same row on the client table and then having lots of blank fields for the smaller companies. Lots of blank fields in your data is often a sign of poor database design.



Reply With Quote
  #4  
Old July 22nd, 2003, 03:44 PM
bakertrg's Avatar
bakertrg bakertrg is offline
Contributing User
Codewalkers Regular (2000 - 2499 posts)
 
Join Date: Apr 2007
Location: Scottsdale AZ, US
Posts: 2,253 bakertrg User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 48 m 45 sec
Reputation Power: 4
Send a message via Yahoo to bakertrg
RE: a database of databases???

oops. One more suggestion. You probably don't want to add a saleperson id to the client/account table. It's far better database design to have the link between the clients and the salesperson be in the orders table (this table will be the largest in 99.9% of situations and has few fields) if you must assign a salesperson to each client it is better to add one more table "assignment" so that when new people come on board or assignments change, you don't have the potential for a deletion anomaly and the subsequent loss of historical data. This also allows for multiple sales people to be assigned to a large client and also will accurately reflect who get's the commission if someone was covering for a sick or vacationing employee.

Reply With Quote
Reply

Viewing: Codewalkers ForumsOther TechnologiesDatabase Help > a database of databases???


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 2 hosted by Hostway