O'Reilly logo

MySQL 8 Cookbook by Karthik Appigatla

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Retrieve JSON

You can retrieve the fields of the JSON column using the -> and ->> operators:

mysql> SELECT emp_no, details->'$.address.pin' pin FROM emp_details;+--------+----------+| emp_no | pin      |+--------+----------+| 1      | "560103" |+--------+----------+1 row in set (0.00 sec)

To retrieve data without quotes, use the ->> operator:

mysql> SELECT emp_no, details->>'$.address.pin' pin FROM emp_details;+--------+--------+| emp_no | pin    |+--------+--------+| 1      | 560103 |+--------+--------+1 row in set (0.00 sec)

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required