Setting up the JSON_SHRED_BATCH Examples

Teradata Vantageā„¢ JSON Data Type

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1150-162K

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

CREATE TABLE emp_table (
	empID INTEGER,
	company	VARCHAR(50), 
	empName VARCHAR(20),
	empAge	INTEGER,
	dept VARCHAR(20),
	startDate DATE FORMAT 'YY/MM/DD',
	site VARCHAR(20))
PRIMARY INDEX (company, empID);

CREATE MULTISET TABLE dept_table (
	dept          VARCHAR(20),
	description   VARCHAR(200),
	empID         INTEGER);

CREATE TABLE json_table (
	id  INTEGER,
	empPersonalInfo	JSON(1000),
	empCompanyInfo JSON(1000),
	site VARCHAR(20));
Insert sample data into the table.
INSERT INTO json_table (1,
  '{"employees" : {
    "company" : "Teradata",
    "info" : 
      [ 
        { "id" : 1, 
          "name" : "Cameron", 
          "age" : 24,
          "dept" : "engineering"},
        { "id" : 2, 
          "name" : "Justin", 
          "age" : 30,
          "dept" : "engineering"},
        { "id" : 3, 
          "name" : "Melissa", 
          "age" : 24, 
          "dept" : "marketing"}
     ]}}',
  '{"startDates" : {
    "company" : "Teradata",
    "info" : 
      [ 
        {"id" : 1, "startDate" : "2015/02/10"},
        {"id" : 2, "startDate" : "2015/02/07"},
        {"id" : 3, "startDate" : null}
      ]}}', 'RB'
);