title: Can I do case insensitive search with JSON_EXTRACT in MySQL?
body: <p>I am running <code>SELECT * FROM mytable WHERE LOWER(JSON_EXTRACT(metadata, "$.title")) = 'hello world'</code> with the intent that <code>hello world</code> is data from a user that I will flatten to all lowercase. The actual value in my db is "Hello World", but this search comes back empty every time.</p>
  
  <p>If I do a <code>SELECT LOWER(JSON_EXTRACT(metadata, "$.title")) FROM mytable</code>, it certainly comes back lowercase as <code>hello world</code>. Not sure what I'm missing here.</p>
  
  <p><strong>Queries to get actual values:</strong></p>
  
  <p><code>SELECT JSON_EXTRACT(metadata, "$.title")  FROM mytable</code> gets me <code>"Hello World"</code></p>
  
  <p><code>SELECT LOWER(JSON_EXTRACT(metadata, "$.title"))  FROM mytable</code> gets me <code>"hello world"</code></p>
  
  <p><strong>Queries trying to find the right row</strong></p>
  
  <p><em>Gets me value</em></p>
  
  <p><code>SELECT * FROM mytable WHERE JSON_EXTRACT(metadata, "$.title") = "Hello World"</code></p>
  
  <p><code>SELECT * FROM mytable WHERE metadata-&gt;"$.title" = "Hello World"</code></p>
  
  <p><code>SELECT * FROM ututs WHERE LOWER(metadata-&gt;"$.title")  LIKE "%hello world%"</code></p>
  
  <p><em>Gets me nothing</em></p>
  
  <p><code>SELECT * FROM mytable WHERE JSON_EXTRACT(metadata, "$.title") = "hello world"</code></p>
  
  <p><code>SELECT * FROM mytable WHERE JSON_EXTRACT(metadata, "$.title") LIKE  "%hello world%"</code></p>
  
  <p><code>SELECT * FROM ututs WHERE LOWER(metadata-&gt;"$.title") = "hello world"</code></p>
  
  <p><code>SELECT * FROM ututs WHERE LOWER(metadata-&gt;"$.title")  LIKE "hello"</code></p>
  
  <p>So it looks like the result is giving back the value, including quotes. That doesn't appear to be the issue though, given I get a result when I match the case. I am also confused why the <code>%</code> at the start is solving my issue. There is no space between the <code>"</code> and <code>H</code>. I typed the JSON out myself.</p>
  
  <p>I also updated <code>metadata</code> column straight to <code>{"title":"Hello World"}</code> by manually typing. MySQL automatically adds a space after colon to make it <code>{"title": "Hello World"}</code>, which is fine, but was just sanity checking any spaces.</p>