15.10 - Setting Up the JSON_SHRED_BATCH JSONID and ROWINDEX Keyword Example - 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

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

CREATE TABLE JSONDocs(
   JSONDocId INTEGER,
   jsnCol JSON(10000),
   site VARCHAR(200),
   country VARCHAR(200)
) UNIQUE PRIMARY INDEX (JSONDocId);

INSERT INTO JSONDocs VALUES('1', 
  NEW JSON('{"employees" : {"company" : "Teradata","info" : [ 
            {"id" : 1, "name" : "Cameron", "dept" : "engineering"},
            {"id" : 2, "name" : "Justin","dept" : "engineering"}
                    ]}}', LATIN),'HYD','USA');

INSERT INTO JSONDocs VALUES('2', 
  NEW JSON('{"employees" : {"company" : "Teradata","info" : [ 
            {"id" : 3, "name" : "Madhu", "dept" : "engineering"},
            {"id" : 4, "name" : "Srini","dept" : "engineering"}
                    ]}}', LATIN),'HYD','USA');

CREATE TABLE jsonshred.Teradata_Employees(
   rowIndex INTEGER, 
   empId INTEGER, 
   empName varchar(30), 
   company varchar(30),
   dept varchar(10), 
   jsonDocId INTEGER,
   site varchar(10), 
   country varchar(10));