top of page
CerebroSQL

JSON_REMOVE

База данных: MySQL

68747470733a2f2f7374796c65732e7265646469746d656469612e636f6d2f74355f32716d366b2f7374796c65

Syntax:
JSON_REMOVE(json_doc, path[, path] ...)

Removes data from a JSON document and returns the result. Returns NULL
if any argument is NULL. An error occurs if the json_doc argument is
not a valid JSON document or any path argument is not a valid path
expression or is $ or contains a * or ** wildcard.

The path arguments are evaluated left to right. The document produced
by evaluating one path becomes the new value against which the next
path is evaluated.

It is not an error if the element to be removed does not exist in the
document; in that case, the path does not affect the document.

URL: https://dev.mysql.com/doc/refman/8.0/en/json-modification-functions.html

Example

mysql> SET @j = '["a", ["b", "c"], "d"]';
mysql> SELECT JSON_REMOVE(@j, '$[1]');
+-------------------------+
| JSON_REMOVE(@j, '$[1]') |
+-------------------------+
| ["a", "d"] |
+-------------------------+

bottom of page