15.10 - Example: Using JSON_AGG without GROUP BY and No Parameter Names - Teradata Database

Teradata Database Teradata JSON

Product
Teradata Database
Release Number
15.10
Published
December 2015
Language
English (United States)
Last Update
2018-06-05
dita:mapPath
TeradataJSON_15_10.ditamap
dita:ditavalPath
ft:empty
The example selects columns from a table and uses JSON_AGG to compose those columns into JSON objects.
SELECT JSON_agg(empID, company, empName, empAge)
FROM emp_table;

Result:

JSON_agg
--------
[{ "empID" : 1, "company" : "Teradata", "empName" : "Cameron", "empAge" : 24 },{ "empID" : 2, "company" : "Teradata", "empName" : "Justin", "empAge" : 34 },{ "empID" : 3, "company" : "Teradata", "empName" : "Someone", "empAge" : 24 }]