JSON_KEYS Table Operator Examples | Teradata Vantage - Setting Up the JSON_Keys Examples - Advanced SQL Engine - Teradata Database

JSON Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
September 2020
Language
English (United States)
Last Update
2021-01-23
dita:mapPath
gzn1554761068186.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1150
lifecycle
previous
Product Category
Teradata Vantageā„¢

Create and populate table(s) to use in subsequent example(s).

CREATE TABLE json_table(
    id int,
	json_data JSON(32000)
);

INSERT json_table(1, '
{
    "coord": {
        "lon": 145.766663,
        "lat": -16.91667
    },
    "sys": {
        "country": "AU",
        "sunrise": 1375216946,
        "sunset": 1375257851
    },
    "weather": [
        {
            "id": 800,
            "main": "Clear",
            "description": "Sky is Clear",
            "icon": "01n"
        }
    ],
    "base": "global stations",
    "main": {
        "temp": 288.97,
        "humidity": 99,
        "pressure": 1007,
        "temp_min": 288.71,
        "temp_max": 289.15
    },
    "wind": {
        "speed": 5.35,
        "deg": 145.001
    },
    "clouds": {
        "all": 0
    },
    "dt": 1375292971,
    "id": 2172797,
    "name": "Cairns",
    "cod": 200
}
');

INSERT json_table(2, '
{
    "coord": {
        "lon": 245.766663,
        "lat": -16.91667
    },
    "sys": {
        "country": "US",
        "sunrise": 1375216946,
        "sunset": 1375257851
    },
    "weather": [
        {
            "id": 800,
            "main": "Clear",
            "description": "Sky is Cloudy",
            "icon": "01n"
        }
    ],
    "base": "global stations",
    "main": {
        "temp": 288.97,
        "humidity": 99,
        "pressure": 1007,
        "temp_min": 288.71,
        "temp_max": 289.15,
        "temp_scale" : "Fahrenheit"
    },
    "wind": {
        "speed": 5.35,
        "deg": 145.001
    },
    "clouds": {
        "all":0
    },
    "dt": 1375292971,
    "id": 2172797,
    "name": "Los Angeles",
    "cod": 200
}
');