17.10 - Example: Create Tables with JSON Data Type Columns - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Data Definition Language Syntax and Examples

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1144-171K
Language
English (United States)

This example creates a table with a JASON column that is non-LOB.

CREATE TABLE jsonTable1(id INTEGER,
                       jsn1 JSON(64000) CHARACTER SET LATIN);

This example creates a table with non-LOB and LOB JASON columns.

CREATE TABLE jsonTable2(id INTEGER,
                jsn1 JSON(1000) CHARACTER SET LATIN,
                jsn2 JSON INLINE LENGTH 30000 CHARACTER SET LATIN);

This example uses a different syntax to create the same structure as jsonTable2, a table with non-LOB and LOB JASON columns.

CREATE TABLE jsonTable3(id INTEGER,
               jsn1 JSON(1000) INLINE LENGTH 1000 CHARACTER SET LATIN,
               jsn2 JSON INLINE LENGTH 30000 CHARACTER SET LATIN);

This example creates a table with the following types of JSON columns: non-LOB and LOB with specified inline lengths. When the specified maximum length is equal to the inline length, the CDT is a non-LOB type.

CREATE TABLE jsonTable4(id INTEGER,
               jsn1 JSON(30000) INLINE LENGTH 30000,
               jsn2 JSON INLINE LENGTH 100);

This example creates a table with an JSON column that is an LOB with a specified inline length.

CREATE TABLE jsonTable5(id INTEGER,
                 jsn1 JSON(64000) INLINE LENGTH 100);

This example creates a table with an JSON column that is non-LOB with a specified inline length and a Binary JSON storage format.

CREATE TABLE jsonTable6(id INTEGER,
               jsn1 JSON(64000) INLINE LENGTH 64000 STORAGE FORMAT BSON);

This example creates a table with an JSON column that is non-LOB with a specified inline length and a Universal Binary JSON storage format.

CREATE TABLE jsonTable7(id INTEGER,
               jsn1 JSON(64000) INLINE LENGTH 64000 STORAGE FORMAT UBJSON);