Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

The Database Forum


You are currently viewing our The Database Forum as a guest. Please register to participate.
Login



Reply
Can any DBAs help me with my Models?
Old 01-21-2008, 11:07 PM Can any DBAs help me with my Models?
Super Talker

Posts: 126
Name: Alan
Trades: 0
Okay, here is what I want to do (not exactly but it's completely analogous):

There are Companies. Companies have some information, such as name and website and general info. They will have an ID and that will be the primary key.

There are Users. Users have info like email address, password, which company/ies they work for (eek... can a database store an "array" of companies worked for?!), and basic housekeeping stuff like preferences. They will have an ID and that will be the primary key, unless maybe email address works better, since that is guaranteed to be unique.

What I want to do is have users vote on their companies. Do they like working for their company? Other users can also vote on other companies like what they think about them.

I was thinking of having a Votes model, where each row would contain the user who voted and the company voted for and the score that was given, but I think that this would scale very poorly.

What is the proper way to set something like this up? (By the way, is this a basic problem? intermediate?) Do the models change if I want to, rather than figure average rankings out on demand, store the average ranking so that it gets updated less frequently to reduce overhead?

Thanks so much!
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


aschwa is offline
Reply With Quote
View Public Profile Visit aschwa's homepage!
 
 
Register now for full access!
Old 01-22-2008, 12:03 AM Re: Can any DBAs help me with my Models?
ForrestCroce's Avatar
Half Man, Half Amazing

Posts: 3,023
Name: Forrest Croce
Location: Seattle, WA
Trades: 0
You could have a users table, a companies table, and an employment history table, so that one person can have worked for several companies.

Calculating the average ahead of time vs on demand depends on how people use your application ... but the overhead of updating averages every time someone votes is probably going to take a lot of avg queries to be worthwhile.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
ForrestCroce is offline
Reply With Quote
View Public Profile Visit ForrestCroce's homepage!
 
Old 01-22-2008, 12:06 AM Re: Can any DBAs help me with my Models?
Super Talker

Posts: 126
Name: Alan
Trades: 0
Quote:
Originally Posted by ForrestCroce View Post
You could have a users table, a companies table, and an employment history table, so that one person can have worked for several companies.

Calculating the average ahead of time vs on demand depends on how people use your application ... but the overhead of updating averages every time someone votes is probably going to take a lot of avg queries to be worthwhile.
Thank you.

Do you know how I might efficiently implement the actual table data for the votes?
__________________

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE


aschwa is offline
Reply With Quote
View Public Profile Visit aschwa's homepage!
 
Reply     « Reply to Can any DBAs help me with my Models?
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.39659 seconds with 12 queries