close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Data structure advice

Thread began 9/02/2014 12:16 pm by iainmacdonald331081 | Last modified 9/05/2014 9:23 am by iainmacdonald331081 | 895 views | 14 replies

iainmacdonald331081

Data structure advice

Just looking for a bit of advice as to how to best go set up my database structure.

I currently have the following tables:

lodges

LodgeID (PK)
Lodge
etc

scores

ScoreID (PK)
Score
CategoryID (FK)
LodgeID (FK)
etc

categoriesFull

CategoryID (PK)
Category
etc

countries

CountryID (PK)
Country

So any lodge can have multiple scores, in multiple categories.

And I can currently produce a list of lodges for any given category, in a particular country which lists the lodge, the number of votes in the category, and the average score in the for that category, using:

SELECT ScoreID, COUNT(ScoreID) as scoreCount, AVG(Score) as AverageScore, lodges.LodgeID, Lodge, Country, lodges.CountryID, CategoryID FROM lodges INNER JOIN countries ON lodges.CountryID = countries.CountryID INNER JOIN scores ON lodges.LodgeID = scores.LodgeID WHERE lodges.CountryID = 37 AND CategoryID='14' GROUP BY Lodge

So far, so good.

What I'm looking to do now is allow create two new fields, 'rank', and 'finalist'. So the plan is to use an update multiple record on those pages, with a tick box for 'finalist' and a text / integer field for 'rank'.

So someone can view all the lodges in a list and just tick the boxes for the ones they want to be a finalist, enter the rank of 1-10 for the top 10 ,and click update to update all the records. (Or if it's a new table it would be an insert multiple records)

However, I am not sure which table it would be best to put these in. They're kind of related to the scores, but really apply to the lodges, i.e. any given lodge will be deemed to be a finalist in a particular category, and may be ranked in any category.

At the moment I'm thinking I just need an extra table:

finalists

FinalistID (PK)
Finalist (yes / no)
Rank
LodgeID (FK)
CategoryID (FK)
CountryID (FK)

Hope that makes sense - any advice on this would be appreciated before I start down the wrong path.

Thank you!

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...