|
Posted by Jerry Stuckle on 11/19/77 11:47
guitarromantic@gmail.com wrote:
> Rik wrote:
>
>
>> An extra table would help to make the data more accessable.
>>
>>TABLE reviews
>>review_id
>>some_other_fields
>>
>>TABLE staff
>>staff_id
>>some_other_fields
>>
>>TABLE staff_reviews
>>review_id
>>staff_id
>
>
> Just to clarify - so when I display a review, would I have to then
> search staff_reviews for $foo (review id) and then select all the
> associated staff_ids to then display my links and stuff?
>
> I think this is a better method also because as well as each review
> having multiple authors, it has multiple scores too (currently we just
> write the individual scores in the body of the review and store the
> average score in the db - with this system I can store a score for each
> review in staff_reviews and then just use php to display the average,
> right?
>
Yes, you would. But it will be much easier and more flexible than trying to
keep a list of comma separated values.
And think of the future. For instance, what if you want to add a staff member
to a review? In your method, you have to read the current comma separated list,
add the reviewer to the end and put it back. Or if you mistakenly added one and
need to delete it, you have to read, remove and rewrite. With a separate table
it's a matter of insert or delete, and that's all.
Also, what if you want to find a list of all articles reviewed by a certain
staff member? Much more difficult with your setup.
When you have a multi-multi link like this, it's virtually certain a separate
table is the way to go.
--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================
[Back to original message]
|