文档
- https://dev.mysql.com/doc/refman/8.0/en/json.html
- https://dev.mysql.com/doc/refman/8.0/en/json-search-functions.html
JSON_CONTAINS(target, candidate[, path])
value MEMBER OF(json_array)
mysql> set @list = JSON_ARRAY(1, 2);
Query OK, 0 rows affected (0.01 sec)
mysql> select 1 MEMBER OF(@list);
+--------------------+
| 1 MEMBER OF(@list) |
+--------------------+
| 1 |
+--------------------+
1 row in set (0.00 sec)
mysql> SELECT JSON_CONTAINS(@list, '1');
+---------------------------+
| JSON_CONTAINS(@list, '1') |
+---------------------------+
| 1 |
+---------------------------+
1 row in set (0.01 sec)