Normal Approach
Table A: ID, CATEGORY
TABLE B: ID, CATEGORY_ID, SUBCATEGORY
Just use 2 Tables.
Approach with subcategories related to more than one category
Table A: ID, CATEGORY
TABLE B: ID, SUBCATEGORY
TABLE C: ID, CATEGORY_ID, SUBCATEGORY_ID
Use this if you have subcategories added to more than one category.
Different Approach
TABLE A: ID, CATEGORY, SUBCATEGORY AS TEXT (SUBCATEGORIES as JSON List. e.g. ["SUB_1", "SUB_2"])
If you have a lot of subcategories added to more than one categories. In this case just save the SUBCATEGORY_ID in the list. Theen
TABLE A: ID, CATEGORY, SUBCATEGORY AS TEXT (SUBCATEGORIES_ID saved as JSON List. e.g. ["1","2"])
TABLE B: ID, SUBCATEGORY
It just depends if you want to search after subcategory in this case. If yes take the normal approach.