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 7845035
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:05:32+00:00 2026-06-02T17:05:32+00:00

I have a table with products that fall under specific categories, but the products

  • 0

I have a table with products that fall under specific categories, but the products within each category can contain multiple meta data tracking field

Table: products

 id    name          category     metadata
 1   something          1      blue,red,purple
 2   something else     2      left,right,middle

I have been trying to contemplate the best method to have a single product table but can’t seem to squeeze the metadata in conveniently. for now I have created a table with all the metadata and fields for tracking the related category (the sequence is so i can order them withing a dropdown etc..)

Updated table: products

 id    name          category   metadata
 1   something          1         1,2,3
 2   something else     2         4,5,6

Table: metadata

 id   category   sequence   option
 1        1         1        blue
 2        1         2        red
 3        1         3        purple
 4        2         1        left
 5        2         2        right
 6        2         3        middle

If this format makes sense .. I am trying to generate a query that will search for values in my product table and grab each and all of the related meta values. The issue I am having is trying to find a unique value in the products field. if I do a MySQL search for LIKE(%1%) I will get matches for 1, 11, 21, 31 etc … I thought of adding a leading and trailing comma to the field by default and then search for ",1," which would be unique .. but there has to be a better way …

Any recommendations (regarding format or query)?

  • 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-06-02T17:05:34+00:00Added an answer on June 2, 2026 at 5:05 pm

    It’s not an ideal design to have comma-separated values within a single database field. Aside from the problem you mentioned (difficult to search), your queries will be less efficient, as the DB won’t be able to use indices for the lookup.

    I’d recommend making a separate table products_metadata with a many-to-one relationship to the products table. Have the *metadata_id*, and the *product_id*, which is a foreign key linking back to the products table. That will make your job much easier.

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

Sidebar

Related Questions

I have a products table that contains a FK for a category, the Categories
I have several databases that each have a table called, say, products . One
I have product table - each one of them has several categories; each category
Hello i have a products table that contains normal products and configurable product It
I have a SQL Server DB that has a table of products, and another
I have a standard store schema with an InvoiceLine table that contains Products. I'd
Hey, I have a table called products that has a relationship with itself. This
I have three tables products, sales and costs. The sales and products table each
Here is my problem. For example I have a table Products that contains a
I have a table with products that have columns like this: price[decimals 8,5] and

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.