CREATE INDEX Statement on the virtual column. It is the functional index defined on the virtual column of values from the SQL data type array that forms the multi-valued index. The examples in the following list show the three different ways in which a multi-valued index  zips  can be created on an array  $.zipcode  on a  JSON  column  custinfo  in a table named  customers . In each case, the JSON array is cast to an SQL data type array of  UNSIGNED  integer values. • CREATE TABLE  only: • CREATE TABLE  plus  ALTER TABLE : • CREATE TABLE  plus  CREATE INDEX A multi-valued index can also be defined as part of a composite index. This example shows a composite index that includes two single-valued parts (for the  id  and  modified  columns), and one multi-valued part (for the  custinfo  column): CREATE TABLE customers ( id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, custinfo JSON ); CREATE INDEX zips ON customers ( (CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY)) ); CREATE TABLE customers ( id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, custinfo JSON ); ALTER TABLE customers ADD INDEX zips( (CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY)) ); CREATE TABLE customers ( id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, custinfo JSON, INDEX zips( (CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY)) ) ); CREATE TABLE customers ( id BIGINT NOT NULL AUTO_INCREMENT PRIMARY KEY, modified DATETIME DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, custinfo JSON ); ALTER TABLE customers ADD INDEX comp(id, modified, (CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY)) ); Only one multi-valued key part can be used in a composite index. The multi-valued key part may be used in any order relative to the other parts of the key. In other words, the  ALTER TABLE  statement just shown could have used  comp(id, (CAST(custinfo->’$.zipcode’ AS UNSIGNED ARRAY), modified))  (or any other ordering) and still have been valid. Using multi-valued Indexes The optimizer uses a multi-valued index to fetch records when the following functions are specified in a WHERE  clause: • MEMBER OF() • JSON_CONTAINS() 2520