I have Products and Company tables that look something like this:
Company:
id | name
----------
1 | Google
Products
id | companyId | name
---------------------
1 | 1 | Google Home
2 | 1 | Pixel
Tags
id | name
----------
1 | Consumer Electronics
2 | Computer
3 | Cell Phone
Now I am not sure if I should do a junction table between company -> tags and products -> tags or if there is a way to have one for both or what. When I am searching for companies I want to be able to use the tags for the company and all children products, ie if I search for a Computer and Cell Phone it should find Google. Then if I am searching for Products by Consumer Electronics and Computer, it should return Google Home.
Any help would be greatly appreciated.