title: mysql: find rows which have a field that is a substring of "string"
body: <p>is there a way to write an sql query that finds all rows where the field value is a substring of a given string.</p>
  
  <p>Example:</p>
  
  <pre><code>table names
  
  Name      |      Nickname
  rohit            iamrohitbanga
  banga            rohitnick
  sinan            unur
  </code></pre>
  
  <p>query should be something like</p>
  
  <pre><code>select * from names where Name is a substring of "who is rohit";   // to get first row
  select * from names where Nickname is a substring of "who is rohitnick";   // to get second row
  select * from names where Name is a substring of "who is unur and banga"
  or Nickname is substring of "who is unur and banga";   // to get second and third row
  </code></pre>
  
  <p>How is it possible?</p>
  
  <p>If it is not possible then i'll have to achieve that behaviour in java. i am using jdbc:mysql driver to connect to the database.</p>
  
  <p><strong>Update</strong>
  your solutions work</p>
  
  <p>now a bit of a twist.
  if we want to check if a substring of the field occurs as a substring of the string that we specify.</p>
  
  <pre><code>select * from names where Name is a substring of "who is sina";   // to get third row
  </code></pre>