Help and Database Object Definition Tools | SQL Fundamentals | Teradata Vantage - 17.10 - Help and Database Object Definition Tools - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.10
Release Date
July 2021
Content Type
Programming Reference
Publication ID
B035-1141-171K
Language
English (United States)

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 Information

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.