title: SQL = vs LIKE vs LIKE BINARY, not case sensitive
body: <p>I have encountered rather weird behavior with SQL LIKE, = and LIKE BINARY</p>
  
  <p>Note : The first 3 characters of password is actually <code>3Vf</code> and the rest of the query is syntactically correct too. </p>
  
  <pre><code>SUBSTRING(password,1, 3) = "3VF"      -&gt; returns true
  SUBSTRING(password,1, 3) = "3Vf"      -&gt; returns true
  
  SUBSTRING(password,1, 3) LIKE "3VF"   -&gt; returns true
  SUBSTRING(password,1, 3) LIKE "3Vf"   -&gt; returns true
  </code></pre>
  
  <p>However if i use LIKE BINARY, i get case sensitive behavior</p>
  
  <pre><code>SUBSTRING(password,1, 3) LIKE BINARY "3VF"   -&gt; returns false
  SUBSTRING(password,1, 3) LIKE BINARY "3Vf"   -&gt; returns true
  </code></pre>
  
  <p>I dont understand why the comparisions are case insensitive. Considering the password is a <code>VARCHAR(64)</code>. In all the resources I've seen online it says that = and LIKE both are case sensitive.</p>
  
  <p>Note: the full query I'm running is</p>
  
  <pre><code>SELECT * from users where username="natas16" AND SUBSTRING(password,1, 3) = XX
  </code></pre>
  
  <p>Also, This is <strong>NOT</strong> a real world application but a natas level. It is sort of a 'hacking' playground. They have different levels with vulnerabilities you are supposed to exploit. So this is not a real world example. </p>
  
  <p><a href="http://www.overthewire.org/wargames/natas/" rel="noreferrer">http://www.overthewire.org/wargames/natas/</a></p>