I have following column(descrition field) in my table of data in which i have to extract country name field value. like Spain from this field.
[{“key”: “country_code”, “type”: “string”, “value”: “12”}, {“key”: “country_name”, “type”: “string”, “value”: “Spain”}, {“key”: “timezone”, “type”: “string”, “value”: “Europe/Madrid”}, {“key”: “latitude”, “type”: “string”, “value”: “40.37603”}, {“key”: “longitude”, “type”: “string”, “value”: “-3.69901”}]
enter image description here
How to extract it ? please help me out.
SELECT
json_extract(description, ‘$.key[1]’) AS country
FROM test_table;
Nilu Singh is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.