Examples | DATASET_KEYS Function | Teradata Vantage - 17.10 - Example: Using DATASET_KEYS - Advanced SQL Engine - Teradata Database

Teradata Vantageā„¢ - DATASET Data Type

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Published
July 2021
Language
English (United States)
Last Update
2021-07-27
dita:mapPath
amv1590702100517.ditamap
dita:ditavalPath
amv1590702100517.ditaval

The following example uses DATASET_KEYS on Avro data already stored in a table.

/*simple key extraction*/
SELECT * FROM DATASET_KEYS
(
	ON (SELECT avroFile FROM myAVROTable09)
) AS avroKeys ORDER BY 1;
> Item_ID
  Item_Name
  Item_Color
  Item_Style
  Quantity_Purchased
  Item_Price
  Total_Price

/*display the keys wrapped in double quotes*/
SEL * FROM DATASET_KEYS
(
	ON (SELECT avroFile FROM myAVROTable09)
	USING QUOTES(Y)
) AS avroKeys ORDER BY 1;
> "Item_ID"
  "Item_Name"
  "Item_Color"
  "Item_Style"
  "Quantity_Purchased"
  "Item_Price"
  "Total_Price"

This example uses DATASET_KEYS on CSV data already stored in a table.

/*simple key extraction*/
SELECT * FROM DATASET_KEYS
(
 ON (SELECT csvFile FROM myCSVTable09)
) AS csvKeys ORDER BY 1;
>  ItemName
   ItemNum
   Price
   Quantity
 
/*display the keys wrapped in double quotes*/

SELECT * FROM DATASET_KEYS
(
 ON (SELECT csvFile FROM myCSVTable09)
 USING QUOTES('Y')
) AS csvKeys ORDER BY 1;
>  "ItemName"
   "ItemNum"
   "Price"
   "Quantity"