Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The kind of search you seem to be after is not really the sweet spot for RDBMSs such as MySQL. And specifying the allowable search formats is not generally good for usability, unless it's a rather specific domain.</p> <p>Keeping it very generic, the query to search three fields for "Persons Name Fake Street" could be something like this:</p> <pre><code>SELECT * FROM Users WHERE (FirstName LIKE "%Persons%" OR LastName LIKE "%Persons%" OR Address LIKE "%Persons%") AND (FirstName LIKE "%Name%" OR LastName LIKE "%Name%" OR Address LIKE "%Name%") AND (FirstName LIKE "%Fake%" OR LastName LIKE "%Fake%" OR Address LIKE "%Fake%") AND (FirstName LIKE "%Street%" OR LastName LIKE "%Street%" OR Address LIKE "%Street%") </code></pre> <p>This should find any member who has details matching those given. But isn't very elegant and will only get worse with longer queries and more fields. It's also incredibly inefficient and will struggle quickly as the table gets longer - it's unable to use indexes. It also doesn't help you get the "best" matches at the top (if there are numerous results)</p> <p>A better solution might be to use MySQLs Full Text indexing by creating a separate table that can be searched using the full text index to find the relevant Users. I don't know much about this solution.</p> <p>Another option may be to use an external indexing tool such as Lucene. While it adds more complexity, it allows extra functionality such as weighting of fields. So name could be seen as more important than address for example. This can also order the results in order of relevance.</p> <p>The correct solution depends on your requirements (as always) but those are some ideas that might be worth investigating.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload