A simple way to do this is to split your user input into words, and trim out punctuation:
"xyz, inc." becomes array("xyz", "inc")
Then you can do something like this:
SELECT
*
FROM
company
WHERE
name LIKE '%xyz%'
OR name LIKE '%inc%';
To improve this, you could run the query once per word, and add weightings to them (you would therefore need a weighting table, and it might say that "inc" is a common word and thus does not count significantly). More weightings and more results would increase the ranking of each result.
Bear in mind though that this strategy may not be optimal from a performance perspective, if you have a large table, since LIKE
performs full table scans. If you have 10K rows you'll be fine, but if you have 1M rows, you might not be. As always, you should try it on a representative database to see what performance is like in your case.
This is just a quick-and-simple solution, but you would have better results if you were to install a specific search system, such as ElasticSearch or Lucene.