Other functions

Some of the other functions are as follows:

  • JSON_KEYS(): Gets all the keys in a JSON document:
mysql> SELECT JSON_KEYS(details) FROM emp_details WHERE emp_no = 1;*************************** 1. row ***************************JSON_KEYS(details): ["email", "phone", "address", "nickname", "locatation"]
  •  JSON_LENGTH(): Gives the number of elements in a JSON document:
mysql> SELECT JSON_LENGTH(details) FROM emp_details WHERE emp_no = 1;*************************** 1. row ***************************JSON_LENGTH(details): 5

Get MySQL 8 Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.