Comparison and Ordering of JSON Values As noted previously, in MySQL, the scope of the path is always the document being operated on, represented as  $ . You can use  ’$’  as a synonynm for the document in JSON path expressions. Note Some implementations support column references for scopes of JSON paths; currently, MySQL does not support these. The wildcard  *  and  **  tokens are used as follows: • .*  represents the values of all members in the object. • [*]  represents the values of all cells in the array. • [ prefix ]** suffix  represents all paths beginning with  prefix  and ending with  suffix .  prefix  is optional, while  suffix  is required; in other words, a path may not end in  ** . In addition, a path may not contain the sequence  *** . For path syntax examples, see the descriptions of the various JSON functions that take paths as arguments, such as  JSON_CONTAINS_PATH() ,  JSON_SET() , and  JSON_REPLACE() . For examples which include the use of the  *  and  **  wildcards, see the description of the  JSON_SEARCH()  function. MySQL 8.0.2 and later also supports range notation for subsets of JSON arrays using the  to  keyword (such as  $[2 to 10] ), as well as the  last  keyword as a synonym for the rightmost element of an array. See Searching and Modifying JSON Values, for more information and examples. Comparison and Ordering of JSON Values JSON values can be compared using the  = ,  < ,  <= ,  > ,  >= ,  <> ,  != , and  <=>  operators. The following comparison operators and functions are not yet supported with JSON values: • BETWEEN • IN() • GREATEST() • LEAST() A workaround for the comparison operators and functions just listed is to cast JSON values to a native MySQL numeric or string data type so they have a consistent non-JSON scalar type. Comparison of JSON values takes place at two levels. The first level of comparison is based on the JSON types of the compared values. If the types differ, the comparison result is determined solely by which type has higher precedence. If the two values have the same JSON type, a second level of comparison occurs using type-specific rules. The following list shows the precedences of JSON types, from highest precedence to the lowest. (The type names are those returned by the  JSON_TYPE()  function.) Types shown together on a line have the same precedence. Any value having a JSON type listed earlier in the list compares greater than any value having a JSON type listed later in the list. BLOB BIT OPAQUE 2080