How to retrieve JSON data from MySQL?

Kailash Singh

How to retrieve JSON data from MySQL?

Published Jan 16,2023 by Kailash Singh

0 Comment     432 Views    


In this post, we are going to teach you, How to retrieve JSON data from MySQL?

 

Example Table:

Table Name - customers

 

Query Example:

SELECT 
    ID, CITY,
    json_extract(POPULATION_JSON_DATA, '$.male') AS POPL_MALE,
    json_extract(POPULATION_JSON_DATA, '$.female') AS POPL_FEMALE,
    json_extract(POPULATION_JSON_DATA, '$.other') AS POPL_OTHER
FROM customers;

 

Result:


Comments ( 0 )