I have a big question about relationships in mysql. You see, I'm creating a site that looks like an e-commerce, it's for a colleague.
I am creating a table called categories and another called subcategories . In the subcategories table I have a column called categoria_id
, which will contain the ID of the selected category. Then like this, I will be able to show the subcategories with their respective categories.
An example: Cell Phone Accessories (category), Chargers (subcategory) and so on.
Is it necessary to create a relationship between the category ID, and the category_id of the "subcategories" table? I hope I have explained myself correctly.
Greetings.