For e-commerce application, I need to manage the category and product.
category_id, product_id is the auto_increase value (primary key) created by database.
category_code, product_code are the values merchant can assign to the category or product. And they are unique too. (could be used as key field too.)
My questions are in define the relationships between the tables such as category->product. Should I use the category_id-product_id, or should I use category_code-prodcut_code?
1) category_id-product-id pair, both of them are primary key values. But the values of it are fixed by auto increase feature of the database. When we see this pair, it does not make sense to anyone. such as 10-101
2) category_code-product_code pair, both of them still could be key but just not primary key. and the pair value could make sense to the programmer (in the development stage, or in the maintenance time if necessary.) , that could be a small help sometimes. such as CatBook-Book1224324
Thanks!