Im working on an image sharing site and want to implement tagging for the images.
I've read Questions #20856 and #2504150
I have few concerns with the approach on the questions above. First of all it looks easy to link an image to a tag. However getting images by tag relation is not as easy. Not easy because you will have to get the image-to-tag relation from one table and then make a big query with a bunch of OR statements( one OR for every image).
Before i even research the tagging topic i started testing the following method:
This tables as examples:
Table: Image
Columns: ItemID, Title, Tags
Table: Tag
Columns: TagID, Name
The Tags column in the Image table takes a string with multiple tagID from the Tag table enclosed by dashes(-).
For example:
-65-25-105-
Links an image with the TagID 65,25 and 105.
With this method i find it easier to get images by tag as i can get the TagID with one query and get all the images with another simple query like:
SELECT * FROM Image WHERE Tags LIKE %-65-%
So if i use this method for tagging,
How effective this is?
Is querying by LIKE %-65-% a slow process?
What problems can i face in the future?