15.00 - Help and Database Object Definition Tools - Teradata Database

Teradata Database SQL Fundamentals

prodname
Teradata Database
vrm_release
15.00
category
Programming Reference
featnum
B035-1141-015K

Help and Database Object Definition Tools

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.

For SQL HELP statements, see SQL Data Definition Language Syntax and Examples.

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.

For SQL SHOW statements, see SQL Data Definition Language Syntax and Examples.

Incompatible Characters in HELP and SHOW Output

 

Example  

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