Designing a SQL schema for a combination of many-to-many relationship (variations of products)

后端 未结 6 846
野趣味
野趣味 2020-12-04 07:46

I hope the title is somewhat helpful. I\'m using MySQL as my database

I am building a database of products and am not sure how to handle storing prices/SKU of variat

6条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-04 08:30

    In general terms, you're looking for what's called a grouper or a junk dimension. Basically it's just an row for every combination.@sahalMoidu's schema looks like it should give you what you are asking for.

    But before getting too hung up on normalization, you need to know if the db is there for storing data (transactional, etc) or for getting data out (dimensional, reporting, etc). Even if it is a transactional database, you have to ask yourself what you are trying to accomplish by normalization.

提交回复
热议问题