title: More Efficient Name Querying
body: <p>My question is simple, but the solution I believe is not as simple.</p>
  
  <p>So, I'm looking for an effective way to query the <code>students</code> table using the names of the students using PHP and mySQL. Currently, I have this code :</p>
  
  <pre><code> SELECT * from students 
   WHERE student_number='$searchKey' //can also search using student number
   OR student_fname LIKE '%$searchKey%'
   OR student_lname LIKE '%$searchKey%'
   OR concat(student_lname,' ',student_fname) LIKE '%$searchkey%'
  </code></pre>
  
  <p>Where <code>$searchKey</code> is the search variable. This type of database query is effective enough for one-word or one-name first names.</p>
  
  <p>The problem is, what if I'm looking for "John James Smith", but I only know his name as "John Smith"? How can I still retrieve that "John James Smith" records? All the answers will be appreciated. Thanks in advance.</p>