title: Select all rows where key in JSON key value array
body: <p>Okay, so I just found out that you can save and select on the JSON data type in MySQL.</p>
  
  <p>I tried to follow <a href="https://stackoverflow.com/questions/36249828/how-to-search-json-array-in-mysql">user2458995</a>'s answer to a similar question as mine, (The difference is mine is with a key and the value is an array) I copied his exact code, created the table, put in the data from his insert SQL and tried his select, which gave me an error.</p>
  
  <p>I modified the table here to show a sample of how the data will be stored in my example.</p>
  
  <p>Basically I have this setup</p>
  
  <pre><code>CREATE TABLE my_table (id INT, data JSON);
  
  INSERT INTO my_table VALUES (1, '{"hashtags": ["html", "php", "javascript"], "categories": [2,5,6]}'), (2, '{"hashtags": ["css", "jquery", "html"], "categories": [2,5,6]}')
  </code></pre>
  
  <p>If I want to select all the hashtags I can do it like this </p>
  
  <pre><code>SELECT data-&gt;&gt;"$.hashtags" FROM my_table
  </code></pre>
  
  <p>But how do I select data like a where in?</p>
  
  <p>I imagined something like this </p>
  
  <pre><code>SELECT * FROM `my_table` WHERE 'html' IN (data-&gt;&gt;"$.hashtags")
  </code></pre>
  
  <p>It does execute, but it returns no rows.
  I also tried several other suggested ways but I can't get anything to work</p>
  
  <pre><code>SELECT * FROM `my_table` WHERE JSON_CONTAINS('html', '$.hashtags')
  </code></pre>
  
  <p>I thought this would be a really neat approach, but would it be smarter to just store each category/hashtag in a unique row with an FK id?</p>
  
  <p>I hope someone can help me out here :)</p>