Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 797377
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T22:47:41+00:00 2026-05-14T22:47:41+00:00

Im working on an image sharing site and want to implement tagging for the

  • 0

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?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T22:47:42+00:00Added an answer on May 14, 2026 at 10:47 pm

    You need 3 tables for this.

    Table: Image
    Columns: ImageId, ItemID, Title
    
    Table: Image_Tag
    Columns: ImageId, TagId
    
    Table: Tag
    Columns: TagID, Name

    Then to get all images for a tag you would use:

    SELECT ImageId, Title 
    FROM Image_Tag LEFT JOIN Image USING (ImageId)
    WHERE TagId = $TagId

    This is the typical way to handle many-to-many relationships in a relational database. You would probably benefit by reading about http://en.wikipedia.org/wiki/Database_normalization

    Edit: I see this was already addresses in the other questions you referenced, so I’ll explain further. The biggest problem I see of doing it your way is you can’t take advantage of indexing your id columns which makes your queries less efficient. It also looks like it would be clumsy to update. I would highly suggest not trying to do it that way, at least try out using the 3 table solution. Once it “clicks” for you you’ll thank me.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on an image resize script for php, and had a few questions..
I am working on image processing library in c#. want to improve performance/speed and
I am working on an image generation script in PHP and have gotten it
I'm working on an image processing application where I have two threads on top
I'm working in image processing project, and I have this problem: If I made
I want to learn c++ as I will be working on image recognition, etc.
I am working on Text Sharing on From my Android Application . I have
Imagine you have an RGB image and want to process every pixel: import numpy
I am working on image processing . I have a buffered image of fixed
I am working on a community photo sharing site, and I need some way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.