Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Database Design and Application Architecture
 Documents Database

Author  Topic 

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-01-31 : 12:25:27
Hello,

I need to create a database to hold documents information.

1. Basically, I need the following information for each document:

Title, Description, LastUpdated, Category, Type, Url

Should I create tables for Category and Type?
And link them to my documents table?
What type of relationship should I use?

2. I also need to know how many downloads each document had

Should I add a column in my documents table?
Then I would increase it one by one.
Or should I create a new table which would register each download.

3. I need to let users to rate each document from 1 to 5.
How should I implement this?

Thank You Very Much,
Miguel

Kristen
Test

22859 Posts

Posted - 2007-01-31 : 13:28:19
My opinions:

1:

Should I create tables for Category and Type? = YES

And link them to my documents table? = YES

What type of relationship should I use? = FK?

2:

Or should I create a new table which would register each download = YES
(otherwise every download will "hit" the Docuemnts table - and if that has, say, an Audit/Archive trigger that will get "hit" too. As another example: I always keep "stock level" type information out of the "stock" table)

3:

"How should I implement this?"

I would have a table with something like:

Document ID
UserID
Rating (1-5 or whatever)
Date
User's comment

Kristen
Go to Top of Page

shapper
Constraint Violating Yak Guru

450 Posts

Posted - 2007-01-31 : 13:37:49
quote:
Originally posted by Kristen


I would have a table with something like:

Document ID
UserID
Rating (1-5 or whatever)
Date
User's comment



Hi Kristen,

When I wrote rating I was talking about the 5 star method which is used for example in MSFT forums.

I don't think this rating is an individual rating.
I think each user gives a rating and then maybe the median value is found from all the ratings of that document and display as a 5 start system.

I believe this is something simpler ... but I am not completely sure.

Thanks,
Miguel
Go to Top of Page

SwePeso
Patron Saint of Lost Yaks

30421 Posts

Posted - 2007-01-31 : 14:19:40
Never use odd count of choices. Most people will use the option in middle because they do not want to take a stand. Either use 6 (optimal) or 4 choices.


Peter Larsson
Helsingborg, Sweden
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2007-01-31 : 14:24:16
"I don't think this rating is an individual rating."

Indeed, but you can take an Average of the values stored. Plus you could (if you want) do like Amazon do and show each individual's rating and comment.

Be that as it may, in order to store a running average you either need every individual value (and then take an Average of them all), or you need to store several values that allow you to compute the average (I suppose it will be the running sum-of-values and number-of-items, and then you can divide first-by-second to get the current average)

Kristen
Go to Top of Page
   

- Advertisement -