Name: Anonymous 2010-02-06 22:29
I am working on a PHP/MySQL project. One of the things it will do is basically tag images. I have a tag table set up in the database(since tags will need more than just a name field).
My friend is trying to convince me that I should just put all the tag keys that apply to an image into its record on the image table instead of relating them through a middle table.
Basically what he is telling me I should do is like below:
image Table Example:
ID, Image_Path, Tags
1, yar.jpg, 6 9 3 14
tag Table Example
ID, Tag_Name, Tag_Description
1, Yar, Pirate Sound
And not have a middle relational table. Instead exploding the tags field when I need to process the image entry and looking up the tags.
I am thinking this is more complicated and less efficient than just using a relational table between the image table and tag table.
Is it better to do it his way, should I be using a relational table, or are both of these ideas bad?
My friend is trying to convince me that I should just put all the tag keys that apply to an image into its record on the image table instead of relating them through a middle table.
Basically what he is telling me I should do is like below:
image Table Example:
ID, Image_Path, Tags
1, yar.jpg, 6 9 3 14
tag Table Example
ID, Tag_Name, Tag_Description
1, Yar, Pirate Sound
And not have a middle relational table. Instead exploding the tags field when I need to process the image entry and looking up the tags.
I am thinking this is more complicated and less efficient than just using a relational table between the image table and tag table.
Is it better to do it his way, should I be using a relational table, or are both of these ideas bad?