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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:39:17+00:00 2026-06-17T08:39:17+00:00

Ok so we have Table 1 (T1) and Table 2 (T2) Structure: T1 (main

  • 0

Ok so we have Table 1 (T1) and Table 2 (T2)

Structure:

T1 (main table):
ID (Auto-Increment)
Name
Properties

T2 (properties table):
ID
Property Name

Let’s say table 1 has two entries. Table 2 has 4 properties.
What i want to do is set the properties of entry 1 in table 1 to map to property 1, 2 and 3 in table 2. For entry 2 in table 1, i want to map it to property 2, 3 and 4 in table 2.

For example, let’s say we have two products, a BALL and a CUBE. Those would be listed in table 1. Now let’s say table 2 holds all available COLORS.

Table 2:
ID COLOR
1  RED
2  BLUE
3  GREEN
4  YELLOW

Table 1:
ID NAME AVAILABLE_COLORS
1  BALL (TABLE 2 ENTRY 1, TABLE 2 ENTRY 2, TABLE 2 ENTRY 3, in other words RED BLUE GREEN)
2  CUBE (TABLE 2 ENTRY 2, TABLE 2 ENTRY 3, TABLE 2 ENTRY 4, in other words BLUE GREEN YELLOW)

How would i get the available colors to point to the colors table? Basically i want to make sure if i change a property (say color red->black), it gets automatically changed for all table 1 entries.

usually if i would only need to assign one color to one item, and that color cannot be used in another item, i would simply add a column in table 2 with “belongs to” or something like that, and this way i can set multiple colors to match the same entry in table 1, however, i can only assign a color to one entry that way… i cannot assign per say red to both ball and cube.

Anyone got any idea?

  • 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-17T08:39:19+00:00Added an answer on June 17, 2026 at 8:39 am

    What I usually do is create a third table to track which products are available in which colors. Let’s say a catalog table. All it stores is an primary ID and the ID of products and the ID of colors.

    Table 3:  Catalog
    ID ColorsID ProductsID
    1 1 1  // row one connects with colors and products and this is a red ball 
    2 2 1  // blue ball
    3 1 2  // red cube
    4 4 2  // yellow cube
    

    Doing it this way you can connect as many attributes to products as you need. It requires more work to keep track of your catalog but makes things much easier in the long run. Remove the available colors from products and only store the product ID and product name in that table. Any else that is standard like description that will not necessarily change with color. This way if you change your available colors from 3 to say 10 you do not have to add new fields to track. You can also take the catalog and add extra fields like active or in-stock that tracks if product is currently available in that color. In catalog you can also store inventory numbers. What if your price is different based on color? White balls are cheaper? All good reasons for normal the data.

    Normalization is about making sure each table has the only minimal fields and to get rid of dependencies.
    View this accepted answer for a good explanation of normalization on the theory level.
    Normalization in MYSQL

    You can then use JOINS to connect them all to loop through the catalog table.

    SELECT Colors.ColorID as Color, Products.ProductID as Product
    FROM Catalog
        INNER JOIN Colors
            ON Catalog.ColorsID = Colors.ColorID
        INNER JOIN Products 
            ON Catalog.ProductsID = Products.ProductID
    

    More information on JOINS can be found here – http://en.wikipedia.org/wiki/Join_%28SQL%29

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

Sidebar

Related Questions

I have a structure where the main table is USER, other tables include CATEGORY
i have table structure with 3 colums (column1, column2, column3) and i want to
I have an table structure like this mysql> SELECT id, name, parent_id FROM categories;
I have a table structure with columns like this [ID] [Name] [ParentId] [ParentName] The
I have a structure called table, I just want to create a table, like
I have a table structure (Table1) with thead and tbody. My main thead also
I have following table structure: Entity --------------------- id | name Users --------------------- id |
Hi i have a table structure like this. table **geoinfo** id name desc I
Let's say you have a table for branches in your organization. Some of them
I have table structure: ous.txt 1452 1793 out.txt 36796 14997 ouw.txt 478 4247 3

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.