Examples | DATASET_KEYS Function | Teradata Vantage - Example: Using DATASET_KEYS - Analytics Database - Teradata Vantage

DATASET Data Type

Deployment
VantageCloud
VantageCore
Edition
Enterprise
IntelliFlex
VMware
Product
Analytics Database
Teradata Vantage
Release Number
17.20
Published
June 2022
ft:locale
en-US
ft:lastEdition
2023-10-30
dita:mapPath
bka1628112240653.ditamap
dita:ditavalPath
qkf1628213546010.ditaval
dita:id
ekk1458586304878
lifecycle
latest
Product Category
Teradata Vantageā„¢

The following examples use 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;

Result:

> 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;

Result:

> "Item_ID"
  "Item_Name"
  "Item_Color"
  "Item_Style"
  "Quantity_Purchased"
  "Item_Price"
  "Total_Price"

These examples use 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;

Result:

>  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;

Result:

>  "ItemName"
   "ItemNum"
   "Price"
   "Quantity"