problem in many to many relationship

前端 未结 3 863
感情败类
感情败类 2021-01-28 02:37

I have two tables jewelry(j_id,j_name,Description) and style(style_id,style_name,image) each table has a many to many relationship with the other table

3条回答
  •  执念已碎
    2021-01-28 03:28

    I would recommend 4 tables, 3 for the jewellery and style and the fourth one for orders.

    Jewellery : jid (PKEY),jname,description

    Style: sid (PKEY), sname, description

    Product : pid (PKEY), sid(FKEY), jid(FKEY) - One Product defines a unique combination of style and kewellery

    Order : oid(PKEY), pid(FKEY), other details(name, address etc.)

    For each jewellery, recover associated styles using the product table and populate the fields on the html page. For each order, store the product id, which uniquely identifies both the jewellery and style.

提交回复
热议问题