Comparison of JSON_AGG and JSON_COMPOSE - 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ā„¢

JSON_AGG and JSON_COMPOSE are similar functions that take a variable number of input parameters and packages them into a JSON document. Both commands use the same syntax and input parameters.

The difference is JSON_AGG is an aggregate function and JSON_COMPOSE is a scalar function. JSON_COMPOSE can call JSON_AGG to provide a more complex composition of a JSON document than the JSON_AGG function can do by itself.

You cannot use JSON_AGG or JSON_COMPOSE to publish data to the BSON or UBJSON format. To publish data in one of these binary formats, you can do one of the following:
  • Use JSON_PUBLISH instead of JSON_AGG or JSON_COMPOSE.
  • Use JSON_AGG and/or JSON_COMPOSE to create a JSON document, and then convert that document to BSON or UBJSON using a cast expression or the AsBSON method.