I'm using sql in amazon redshift. I have a column called attributes which looks like this:
[{"name": "Size", "value": "Small"},{"name": "Color", "value": "Blue"},{"name": "Material", "value": "Cotton"}]
or
[{"name": "Material", "value": "silk"},{"name": "Color", "value": "Pink"}]
In order to extract the material value, I'm trying to use regex. I have the initial code such:
select REGEXP_SUBSTR(attributes,'Material.*') as string_value
Result:
Material", "value": "Cotton"}]
and
Material", "value": "silk"},{"name": "Color", "value": "Pink"}]
How can I take this a step further and get just the value of material, so output should look like:
Cotton
silk
I'm new to sql and new to regex so would really appreciate your help.