Example: JSONExtract with Filtered Results - Advanced SQL Engine - Teradata Database

JSON Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
uwa1591040057999.ditamap
dita:ditavalPath
uwa1591040057999.ditaval
dita:id
B035-1150
lifecycle
previous
Product Category
Teradata Vantage™
The example uses the JSONExtract method to extract filtered results from a table.
The example uses the table(s) created earlier.
/* JSONExtract with filtered results - get the name of everyone older than 23. */ 

SELECT eno, edata.JSONExtract('$.[?(@.age > 23)].firstName') 
FROM my_table 
ORDER BY 1;
Result:
ENO edata.JSONExtract(…)
---------------------------
1  [ "Cameron" ]
2  ?
3  [ "Alex" ]
4  [ "David" ]