Functions That Search JSON Values •A candidate object is contained in a target object if and only if for each key in the candidate there is a key with the same name in the target and the value associated with the candidate key is contained in the value associated with the target key. Otherwise, the candidate value is not contained in the target document. Starting with MySQL 8.0.17, queries using  JSON_CONTAINS()  on  InnoDB  tables can be optimized using multi-valued indexes; see Multi-Valued Indexes, for more information. mysql>  SET @j = ’{"a": 1, "b": 2, "c": {"d": 4}}’; mysql>  SET @j2 = ’1’; mysql>  SELECT JSON_CONTAINS(@j, @j2, ’$.a’); +-------------------------------+ | JSON_CONTAINS(@j, @j2, ’$.a’) | +-------------------------------+ | 1 | +-------------------------------+ mysql>  SELECT JSON_CONTAINS(@j, @j2, ’$.b’); +-------------------------------+ | JSON_CONTAINS(@j, @j2, ’$.b’) | +-------------------------------+ | 0 | +-------------------------------+ mysql>  SET @j2 = ’{"d": 4}’; mysql>  SELECT JSON_CONTAINS(@j, @j2, ’$.a’); +-------------------------------+ | JSON_CONTAINS(@j, @j2, ’$.a’) | +-------------------------------+ | 0 | +-------------------------------+ mysql>  SELECT JSON_CONTAINS(@j, @j2, ’$.c’); +-------------------------------+ | JSON_CONTAINS(@j, @j2, ’$.c’) | +-------------------------------+ | 1 | +-------------------------------+ • JSON_CONTAINS_PATH( json_doc ,  one_or_all ,  path [,  path ] ...) Returns 0 or 1 to indicate whether a JSON document contains data at a given path or paths. Returns NULL  if any argument is  NULL . An error occurs if the  json_doc  argument is not a valid JSON document, any  path  argument is not a valid path expression, or  one_or_all  is not  ’one’  or  ’all’ . To check for a specific value at a path, use  JSON_CONTAINS()  instead. The return value is 0 if no specified path exists within the document. Otherwise, the return value depends on the  one_or_all  argument: mysql>  SET @j = ’{"a": 1, "b": 2, "c": {"d": 4}}’; mysql>  SELECT JSON_CONTAINS_PATH(@j, ’one’, ’$.a’, ’$.e’); +---------------------------------------------+ | JSON_CONTAINS_PATH(@j, ’one’, ’$.a’, ’$.e’) | +---------------------------------------------+ | 1 | +---------------------------------------------+ mysql>  SELECT JSON_CONTAINS_PATH(@j, ’all’, ’$.a’, ’$.e’); +---------------------------------------------+ 2348 • ’all’ : 1 if all paths exist within the document, 0 otherwise. • ’one’ : 1 if at least one path exists within the document, 0 otherwise.