Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialShane Meikle
13,188 PointsNeed some MySQL Table advice
EDIT BECAUSE CANNOT FIND WAY TO DISPLAY TABLE
Okay, so after some sleep I am going to revise this into something that is actually understandable (hopefully).and using an example more in line with what I am thinking.
Table = PAPER col names are as follows: ID | Paper_name | Color_1 | Color_2 | Color_3 | Color_4 | ((and so on)) | Size_small | Size_large
Instead of that large clunky table, breaking it down to:
Paper col names: ID | Paper_Name
COLOR col names ID | Color
SIZES col names ID | Size
So my question in all this is lets say the first product only uses one color and size. There are columns for multiple colors/sizes. Is there a way to dynamically create tables on each product if their column is not null or is null something I will just need to live with and filter out?
1 Answer
Stone Preston
42,016 Pointsif a toy instance actually has 3 different colors, for example an action figure with red legs, blue torso, and green head or something then including those as attributes in the toy table makes sense, although you may want to make the attribute names more descriptive such as primary color, secondary color, etc.
Shane Meikle
13,188 PointsShane Meikle
13,188 PointsThank you for your reply. For the example, there are no secondary colors.
Another example to use would be paper, it comes in multiple colors.