JSON_Keysの例の設定

Teradata® Database JSONデータ型

brand
Software
prodname
Teradata Database
vrm_release
16.20
category
プログラミング リファレンス
featnum
B035-1150-162K-JPN

後の例で使用するテーブルを作成して、データを取り込みます。

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
}
');