mysql json
parent
1a8569d0ec
commit
48eec1a42b
|
@ -124,24 +124,42 @@
|
||||||
<p>JSON data type is also useful for dumping request, response data.</p>
|
<p>JSON data type is also useful for dumping request, response data.</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>
|
<li>
|
||||||
|
<p>
|
||||||
|
Use <code>JSON_CONTAINS_PATH(col, 'one', '$.key')</code> to check json
|
||||||
|
field exist or not
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>Use <code>col->'$.key'</code> to get value</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>
|
||||||
<a
|
<a
|
||||||
href="https://dev.mysql.com/doc/refman/5.7/en/json.html"
|
href="https://dev.mysql.com/doc/refman/5.7/en/json.html"
|
||||||
rel="nofollow"
|
rel="nofollow"
|
||||||
>For MySQL 5.7</a
|
>For MySQL 5.7</a
|
||||||
>
|
>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
<li>
|
<li>
|
||||||
|
<p>
|
||||||
<a
|
<a
|
||||||
href="https://dev.mysql.com/doc/refman/8.0/en/json.html"
|
href="https://dev.mysql.com/doc/refman/8.0/en/json.html"
|
||||||
rel="nofollow"
|
rel="nofollow"
|
||||||
>For MySQL 8.0</a
|
>For MySQL 8.0</a
|
||||||
>
|
>
|
||||||
|
</p>
|
||||||
|
</li>
|
||||||
|
<li>
|
||||||
|
<p>
|
||||||
|
<a
|
||||||
|
href="https://planetscale.com/blog/indexing-json-in-mysql"
|
||||||
|
rel="nofollow"
|
||||||
|
>Indexing JSON in MySQL</a
|
||||||
|
>
|
||||||
|
</p>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>
|
|
||||||
Use <code>JSON_EXTRACT(col, '$.key') IS NULL</code> to check json field
|
|
||||||
exist or not.
|
|
||||||
</p>
|
|
||||||
<div class="markdown-heading">
|
<div class="markdown-heading">
|
||||||
<h2 class="heading-element">Use index!!!</h2>
|
<h2 class="heading-element">Use index!!!</h2>
|
||||||
<a
|
<a
|
||||||
|
|
|
@ -40,10 +40,12 @@ I always use MySQL json data type for extra field.
|
||||||
|
|
||||||
JSON data type is also useful for dumping request, response data.
|
JSON data type is also useful for dumping request, response data.
|
||||||
|
|
||||||
|
- Use `JSON_CONTAINS_PATH(col, 'one', '$.key')` to check json field exist or not
|
||||||
|
- Use `col->'$.key'` to get value
|
||||||
|
|
||||||
- [For MySQL 5.7](https://dev.mysql.com/doc/refman/5.7/en/json.html)
|
- [For MySQL 5.7](https://dev.mysql.com/doc/refman/5.7/en/json.html)
|
||||||
- [For MySQL 8.0](https://dev.mysql.com/doc/refman/8.0/en/json.html)
|
- [For MySQL 8.0](https://dev.mysql.com/doc/refman/8.0/en/json.html)
|
||||||
|
- [Indexing JSON in MySQL](https://planetscale.com/blog/indexing-json-in-mysql)
|
||||||
Use `JSON_EXTRACT(col, '$.key') IS NULL` to check json field exist or not.
|
|
||||||
|
|
||||||
## Use index!!!
|
## Use index!!!
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue