content_image/733874.jpg content_image/733878.jpg
2 rows in set (0.00 sec) 

See Indexing a Generated Column to Provide a JSON Column Index, for the SQL statements used to create and populate the jemp  table in the set of examples just shown. 

This operator can also be used with JSON arrays, as shown here: 

mysql> CREATE TABLE tj10 (a JSON, b INT); Query OK, 0 rows affected (0.26 sec) 

mysql> INSERT INTO tj10 VALUES -> (’[3,10,5,"x",44]’, 33), -> (’[3,10,5,17,[22,"y",66]]’, 0); Query OK, 2 rows affected (0.04 sec) Records: 2 Duplicates: 0 Warnings: 0 

mysql> SELECT a->"$[3]", a->"$[4][1]" FROM tj10; 

<img src='content_image/733874.jpg'>

2 rows in set (0.00 sec) 

mysql> SELECT a->>"$[3]", a->>"$[4][1]" FROM tj10; 

<img src='content_image/733878.jpg'>

2 rows in set (0.00 sec) 

As with -> , the ->>  operator is always expanded in the output of EXPLAIN , as the following example demonstrates: 

mysql> EXPLAIN SELECT c->>’$.name’ AS name -> FROM jemp WHERE g > 2\G *************************** 1. row *************************** id: 1 select_type: SIMPLE table: jemp partitions: NULL type: range possible_keys: i key: i key_len: 5 ref: NULL rows: 2 filtered: 100.00 Extra: Using where 1 row in set, 1 warning (0.00 sec) 

mysql> SHOW WARNINGS\G *************************** 1. row *************************** Level: Note Code: 1003 Message: /* select#1 */ select json_unquote(json_extract(‘jtest‘.‘jemp‘.‘c‘,’$.name’)) AS ‘name‘ from ‘jtest‘.‘jemp‘ where (‘jtest‘.‘jemp‘.‘g‘ > 2) 1 row in set (0.00 sec) 

This is similar to how MySQL expands the ->  operator in the same circumstances. 

