I’m re-asking a question that was previously deleted here in SO for not being a “programming question”. Hopefully, this is a bit more “programming” than the last post.
First, a few definitions:
- model –
2011 Nissan Sentra - trim –
2011 Nissan Sentra LX
Generally, a particular vehicle would have a list of, say, available colors or equipment options. So a 2011 Nissan Sentra may be available in the following colors:
- Black
- White
- Red
Then, the manufacturer may have made a special color only available to the 2011 Nissan Sentra LX trim:
- Pink with Yellow Polka Dots
If I were building a car website wherein I wanted to capture this information, which of the following should I do:
- Associate the colors to the model?
- Associate the colors to the trim?
- Associate the colors to the model and trim?
My gut feeling is that associating it to the model would be sufficient. Associating to trim would mean duplicates (e.g. 2011 Nissan Sentra LX and 2011 Nissan Sentre SE would both have “Black” as a color). Trying to associate colors to model and trim might be overkill.
Suggestions?
If there are special cases, as you say, where a manufacturer has made a special color only available to a specific trim, like “Pink with Yellow Polka Dots” for the “2011 Nissan Sentra LX trim”
and you want to have those special case stored, you should choose the 2nd option.
So, your relationships would be:
1 manufacturer makes many models
1 model has many trims
1 trim can have many colors and for 1 colour many trims have it
(so you’ll need an association table for this relationship)
With additional information about colours:
One GeneralColour can be named as many Colours by different Manufacturers and
one Manufacturer can “baptize” a GeneralColour with various Colour (names)
Thinking more clearly, the extra
Manufacturer-Colourrelationship is not needed: