Currently I have in my DB(mariaDB 10.3) a column that is called data and contains a json array:
client| data
1 | '["a","b","c"]'
2 | '["k"]'
and I would like to brake it down into
client| data
1 | "a"
1 | "b"
1 | "c"
2 | "k"
Unfortunately, MariaDB does not support "unnesting" function
JSON_TABLE()
, unlike MySQL 8.0.We are left with some kind of iterative approach, typicaly by using a table of numbers to enumerate the array elements. If you have a table with at least as many rows as the maximum number of elements in an array, say
bigtable
, you can do:Demo on DB Fiddle: