Books
in black and white
Main menu
Share a book About us Home
Books
Biology Business Chemistry Computers Culture Economics Fiction Games Guide History Management Mathematical Medicine Mental Fitnes Physics Psychology Scince Sport Technics
Ads

Teradata RDBMS forUNIX SQL Reference - NCR

NCR Teradata RDBMS forUNIX SQL Reference - NCR, 1997. - 913 p.
Download (direct link): teradataforunix1997.pdf
Previous << 1 .. 155 156 157 158 159 160 < 161 > 162 163 164 165 166 167 .. 241 >> Next


SPEC1

DBC

89/05/26

09:47:09

SPEC1

MULTINATIONAL

SWED_EBCDIC

A

8-174

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

HELP COLUMN

HELP COLUMN

The following two statements return information about the attributes of the named column(s) in the named table or view.

HELP COLUMN cname FROM tname HELP COLUMN tname.cname

The next two statements return this attribute information on all the columns of the named table or view. All column attributes are returned except any default values and comments (for these, use HELP TABLE tname).

HELP COLUMN * FROM tname HELP COLUMN tname.*

If a HELP COLUMN statement contains a FROM clause, one or more tables may be referenced in the same statement, as long as each column name is fully qualified (that is, preceded by the table name in the form “tablename.columnname”).

HELP COLUMN also allows the use of an expression:

HELP COLUMN expr

If the target is an expression, HELP COLUMN displays the data type of the expression.

Note that HELP COLUMN returns index information for single-column indexes only. For multiple-column indexes, the columns are shown in the result as being not used in an index.

The HELP COLUMN statement returns the information shown in Table 8-5. Note that for graphic data types, the Max Length represents the number of bytes, not the number of logical characters.

The following shows a sample output display for HELP COLUMN:

CREATE TABLE table_1

(field_1 INTEGER NOT NULL PRIMARY KEY, f2 INTEGER CHECK 9f2>0) CHECK 9f2<100);

HELP COLUMN table_1.f2;

Teradata RDBMS for UNIX SQL Reference

8-175
Teradata SQL Syntax Guide

HELP COLUMN

Column Name f2
Type I
Nullable N
Format -(10)9
Max Length 4
Decimal Total Digits ?
Decimal Fractional Digits ?
Uppercase N
Table/View T
Indexed N
Unique N
Primary N
Title ?
Column Constraint CHECK ((“f2”>0) AND (“f2”<100))

In BTEQ, a ? returned in the displayed listing above indicates a NULL value.

Table 8-4

HELP COLUMN Information and Attributes

Field Data Type Associated Nullable? Description
Column Name CHAR (30) no

8-176

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

HELP COLUMN

Field Data Type Associated Nullable? Description
Type CHAR (2) yes Data type for column data
I1 BYTEINT Note: GF and GV type abbreviations will be changed in
I2 SMALLINT
I INTEGER the next release.
D DECIMAL or NUMERIC
F FLOAT or REAL or DOUBLE PRECISION
DA DATE
CF CHAR
CV VARCHAR
GF GRAPHIC
GV VARGRAPHIC
GV LONG VARGRAPHIC
BF BYTE
BV VARBYTE
Nullab Y -N - e can be NULL is NOT NULL CHAR (1) yes
Format CHAR (30) yes Shows display format.
Max Length SMALLINT yes Maximum amount of storage (in bytes).
Decimal Total Digits SMALLINT If type is decimal.
Decimal Fractional Digits SMALLINT yes If type is decimal.
Range Low FLOAT yes Always null. BETWEEN clause now included in column constraint.
Range High FLOAT yes Always null. BETWEEN clause now included in column constraint.

Teradata RDBMS for UNIX SQL Reference

8-177
Teradata SQL Syntax Guide

HELP COLUMN

Field Data Type Associated Nullable? Description
UpperCase CHAR (1) yes If type is CHAR or VARCHAR.
N not declared as UPPERCASE or CASESPECIFIC
U UPPERCASE
C CASESPECIFIC
B Both UPPERCASE and CASESPECIFIC
Table/View? T - table V - view CHAR (1) Shows column is from table or from view.
Indexed? Y - used in an index N - not used in an index CHAR (1) yes If column is single-column index. Multiple-column indexes return null result.
Unique? Y - index is unique N - index is not unique CHAR (1) yes If column is single-column index. Multiple-column indexes return null result.
Primary? P - primary index S - secondary index CHAR (1) yes If column is single-column index. Multiple-column indexes return null result.
Title VARCHAR (60) yes
Column Constraint VARCHAR (255) yes See example under the previous section, HELP COLUMN.

8-178

Teradata RDBMS for UNIX SQL Reference
Teradata SQL Syntax Guide

HELP CONSTRAINT

HELP CONSTRAINT

HELP CONSTRAINT displays information about a specific named constraint on a table. Unnamed constraint information can be obtained using a SHOW TABLE statement.

There are three main types of constraints:

• Check Constraint

• Referential Constraint

• Unique Constraint

Constraint information for each of these is displayed in the following format.

Check Constraint

Field Data Type Nullable
Constraint Name VARCHAR(30) no
Constraint Type (CHECK) VARCHAR(15) no
Constraint VARCHAR(255) no

Referential Constraint

Field Data Type Nullable
Constraint Name VARCHAR(30) no
Constraint Type (REFERENCE) VARCHAR(15) no
State (VALID/INVALID/INCONSISTE NT/UNRESOLVED) CHAR(12) no
Reference Index ID SMALLINT no
Foreign Key Columns VARCHAR(512) yes
Parent Key Database Name VARCHAR(30) yes
Parent Table Name VARCHAR(30) yes
Previous << 1 .. 155 156 157 158 159 160 < 161 > 162 163 164 165 166 167 .. 241 >> Next