16.20 - Help and Database Object Definition Tools - Teradata Database - Teradata Vantage NewSQL Engine

Teradata Vantage™ SQL Fundamentals

Product
Teradata Database
Teradata Vantage NewSQL Engine
Release Number
16.20
Published
March 2019
Language
English (United States)
Last Update
2019-05-02
dita:mapPath
zce1519094756513.ditamap
dita:ditavalPath
TD_DBS_16_20_Update1.ditaval

Teradata SQL provides several powerful tools to get help about database object definitions and summaries of database object definition statement text.

HELP Statements

Various HELP statements return reports about the current column definitions for named database objects. The reports these statements return can be useful to database designers who need to fine tune index definitions, column definitions (for example, changing data typing to eliminate the necessity of ad hoc conversions), and so on.

SHOW Statements

Most SHOW statements return a CREATE statement indicating the last data definition statement performed against the named database object. Some SHOW statements, such as SHOW QUERY LOGGING, return other information. These statements are particularly useful for application developers who need to develop exact replicas of existing objects for purposes of testing new software.

Example: Incompatible Characters in HELP and SHOW Output

Consider the following definition for a table named department:

CREATE TABLE department, FALLBACK
   (department_number SMALLINT
   ,department_name CHAR(30) NOT NULL
   ,budget_amount DECIMAL(10,2)
   ,manager_employee_number INTEGER
   )
 UNIQUE PRIMARY INDEX (department_number)
,UNIQUE INDEX (department_name);

To get the attributes for the table, use the HELP TABLE statement:

HELP TABLE department;

The HELP TABLE statement returns:

Column Name                    Type Comment
------------------------------ ---- -------------------------
department_number              I2   ?
department_name                CF   ?
budget_amount                  D    ?
manager_employee_number        I    ?

To get the CREATE TABLE statement that defines the department table, use the SHOW TABLE statement:

SHOW TABLE department;

The SHOW TABLE statement returns:

CREATE SET TABLE TERADATA_EDUCATION.department, FALLBACK,
   NO BEFORE JOURNAL,
   NO AFTER JOURNAL,
   CHECKSUM = DEFAULT
   (department_number SMALLINT,
    department_name CHAR(30) CHARACTER SET LATIN
                         NOT CASESPECIFIC NOT NULL,
    budget_amount DECIMAL(10,2),
    manager_employee_number INTEGER)
UNIQUE PRIMARY INDEX ( department_number )
UNIQUE INDEX ( department_name );

Related Topics

For more information about:
  • SQL HELP statements, see Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.
  • SQL SHOW statements, see Teradata Vantage™ SQL Data Definition Language Syntax and Examples, B035-1144.