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

后端 未结 6 849
野趣味
野趣味 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 08:07

    Sku is your primary key. You can setup foreign key relationships to the variants table with sku. Forget about productid entirely.

    Create table x (sku, price, description) primary key sku

提交回复
热议问题