Syntax:
JSON_MERGE_PATCH(json_doc, json_doc[, json_doc] ...)

Performs an RFC 7396 (https://tools.ietf.org/html/rfc7396) compliant
merge of two or more JSON documents and returns the merged result,
without preserving members having duplicate keys. Raises an error if at
least one of the documents passed as arguments to this function is not
valid.

*Note*:

For an explanation and example of the differences between this function
and JSON_MERGE_PRESERVE(), see
https://dev.mysql.com/doc/refman/5.7/en/json-modification-functions.html
#json-merge-patch-json-merge-preserve-compared.

JSON_MERGE_PATCH() performs a merge as follows:

1. If the first argument is not an object, the result of the merge is
   the same as if an empty object had been merged with the second
   argument.

2. If the second argument is not an object, the result of the merge is
   the second argument.

3. If both arguments are objects, the result of the merge is an object
   with the following members:

  o All members of the first object which do not have a corresponding
    member with the same key in the second object.

  o All members of the second object which do not have a corresponding
    key in the first object, and whose value is not the JSON null
    literal.

  o All members with a key that exists in both the first and the second
    object, and whose value in the second object is not the JSON null
    literal. The values of these members are the results of recursively
    merging the value in the first object with the value in the second
    object.

For additional information, see
https://dev.mysql.com/doc/refman/5.7/en/json.html#json-normalization.

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

