The second approach ( Approach 2 ) is a much better solution, rather than creating a separate table, because there is no need for each product to have all the categories in the approach to the one you reserve, creating separate columns, even if the category exists or not, and what if in the future, if one category is enlarged, you will have to change the current table structure, and this will not be an easy task.
Yes Join will be a little slow, but if you create the index correctly, it will work much better.
source share