jeudi 23 avril 2020

Do I need ID column as Primary Key in table which is a dictionary with one column

I want to create "product_category" (some kind of dicrionary) table with only one UNIQUE column "name". Then create a relation with existing table "product" like below: enter image description here

  1. Do I need an extra column "ID" (Primary Key) in table and create a relation with this "ID" column instead of with "name" or just INDEXED "name" column is enough or make "name" column as PK?

  2. Do I need a relation at all? In case of delete row in "product_category" I want to only wipe category out in "product" table.




Aucun commentaire:

Enregistrer un commentaire