I'm working with a query system, and I would like that, for example: If I search for the value "a", it would return all the rows that have "a". I tried using the like command as shown below:
SELECT * FROM usuario WHERE nome LIKE 'a%';
But it only returns me if the value is at the beginning of the line. How can I check if "a" is contained in the line?
The % is a wildcard representing "anything". That is, the search is being done for names that start with "a" and have anything after .
You just need to adapt to anything before and after "a".
SELECT * FROM usuario WHERE nome LIKE '%a%';