How categories and subcategories are related to a member's profile in MySQL

Link: https://support.brilliantdirectories.com/support/solutions/articles/12000035993-how-categories-and-subcategories-are-related-to-a-member-s-profile-in-mysql

  • Table *list_professions* is the table that contains all the information related the main categories
  • Table *users_data* column *profession_id* this is the column that store the main category *ID* for the user
  • Table *list_services*  is the table that contains all the information related the subcategories


Important columns to understand from this table:

  • *service_id=* The id of the services or sublevel
  • *profession_id=* Is the id of *(main_category)* he belongs to. We are gonna call him *grandPa*
  • *master_id=* Is the parent he belongs to this is for sub-sub categories


Example:

------------


*Code* will have a profession_id = 5 on table list_profession


Now you create 2 subcategories on table list_services

*PHP* will have a *service_id = 10* and will have a *profession_id = 5* because he belongs to *CODE* and a master = 0 (the 0 means he is a subcategory).We are gonna call him *Father*


*CakePHP* will have a *profession_id = 5* because he belongs to *CODE* and a master = 10 (the 10 means he is a sub-sub category and his father is PHP).We are gonna call him *SON*


-----

SO:

Code will be grandPa

PHP will be Father

CakePHP will be son

--------------------------

Table *rel_service* is the one the connect a subcategory with a member the important columns are *user_id* and *service_id*