I am setting up a search system for a business guide and at the time of searching I am only able to search for a specific word in a table, for example: pizza. But the ideal would be to see if there is a company called "pizza" or if one that does not have "pizza" in the name is part of the "pizzeria" category, for example, and bring it.
This is the framework I'm using to relate a business to the categories:
| empresa |
|------------|
| id_empresa |
| nome |
| categoria |
|--------------|
| id_categoria |
| nome |
| categoria_empresa |
|----------------------|
| id_categoria_empresa |
| id_empresa |
| id_categoria |
This is the search I'm doing:
SELECT * FROM empresa WHERE nome LIKE %"pizza"%