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

SQL Fundamentals

Product
Advanced SQL Engine
Teradata Database
Release Number
17.05
17.00
Published
June 2020
Language
English (United States)
Last Update
2021-01-24
dita:mapPath
zwv1557098532464.ditamap
dita:ditavalPath
lze1555437562152.ditaval
dita:id
B035-1141
lifecycle
previous
Product Category
Teradata Vantage™

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.