I’m trying to search one of the columns of my database for any records which include a certain word. I have not been able to find any way of doing this with the wizard, and my knowledge of SQL isn’t great enough to come up with the command needed.
SQL is what you need. For selecting a specific phrase:
SELECT * FROM "YOUR_TABLE" WHERE UPPER ( "FIELD_TO_SEARCH") LIKE UPPER ('%master form%')
This statement will search the field for the word group master form
. The UPPER
is used so case is not a concern. If you would want case sensitive:
SELECT * FROM "YOUR_TABLE" WHERE "FIELD_TO_SEARCH" LIKE '%master form%'
More information on ‘LIKE’ usage can be found on this page - click here.
If this answers your question please click on the (upper left area of answer).
The above SQL Select statement searches for your specific phrase only in 1 field of 1 table inside your database. Since a database can have multiple tables, and table can have multiple fields, you’d need to repeat ( or combine with OR’s ) the above steps for every tablefield in your database that could possibly contain the specific phrase.
There are a number of ways to do this, and which method you use might depend on how big your database is.
For large databases you’ll want to use a native database full text search feature like this one found in the MariaDB / MySQL db engine.
The advantage is that the database keeps an index of all words, and so can very quickly search a large database for a string of words.
It’s also harder to use and setup, but I have used it for large databases driven by php code and it works very well.