TITLE Phrase Rules

Teradata Vantage™ Data Types and Literals

brand
Software
Teradata Vantage
prodname
Teradata Database
Teradata Vantage NewSQL Engine
vrm_release
16.20
category
Programming Reference
featnum
B035-1143-162K

Teradata SQL uses the following rules to generate a title for expression x:

IF x is … THEN …
a column reference with an explicit TITLE phrase that title value is returned.

Here is an example:

The explicit title for Project.ProjId, as defined in the CREATE TABLE statement for the Project table, is Project//Id.

The following statement returns the indicated result.

SELECT Proj_Id
FROM Project
WHERE Description='O/E Batch System';
Project
     Id
--------
OE2-0003
a column reference with no explicit TITLE the column name is returned.

Here is an example:

The Salary column has no explicit TITLE.

The following statement returns the indicated result.

SELECT Salary
FROM Employee
WHERE EmpNo = 10002;
Salary
---------
35,000.00
a constant TITLE is a character representation of that constant. The character representation of the constant could be the identical characters or a normalized form of the constant.

Here is an example:

The following statement returns 12 as the column heading for the value 12.

SELECT Name, 12
FROM Employee
WHERE EmpNo = 10003;
Name     12
-------  --
Leidner  12
of the form “operator y”, where operator is a unary (+ or -) or aggregate operator TITLE is ‘operator’ followed by ‘(y)’

Here is an example:

The following statement returns the aggregate operator name (SUM) as part of the column title.

SELECT SUM(Salary)
FROM Employee
WHERE DeptNo = 700;
Sum(Salary)
-----------
113,000.00
of the form

“y operator z”

y followed by “operator” followed by z.

Here is an example:

The following statement returns the headings of the column data for which the computation is performed and the operator.

SELECT Salary_Loan - 1000
FROM Employee_Loan
WHERE EmpNo = 10004;
Salary_Loan - 1000
------------------
          41000.00
an attribute function of the form “function (y)” TITLE is function, followed by (y).

Here is an example:

The following statement returns the indicated result.

SELECT FORMAT (Employee.EmpNo);
Format(EmpNo)
-------------
ZZZZ9
of the form

“y (data_description)”, where data_description does not contain a TITLE phrase or a NAMED phrase

TITLE is (y).

Here is an example:

The following statement returns the indicated result.

SELECT YrsExp (BYTEINT)
FROM Employee
WHERE EmpNo = 10016;
YrsExp
------
    20
of the form

“y (data_description)”, where data_description does not contain a TITLE phrase, but does contain a NAMED phrase

TITLE is the name that is specified in the NAMED phrase.

Here is an example:

The following statement returns the indicated result.

SELECT YrsExp (BYTEINT, NAMED YearsOfExperience)
FROM Employee
WHERE EmpNo = 10016;
YearsOfExperience
-----------------
               20
of the form

“y (data_description)”, where data_description contains a TITLE phrase

TITLE is the title that is specified by the phrase.

Here is an example:

The following statement returns the indicated result.

SELECT Salary (INTEGER, TITLE 'Pay')
FROM Employee
WHERE EmpNo = 10018;
Pay
-----
65000

The number of dashes used to define column width is an attribute of BTEQ.

You can modify this display by including a FORMAT phrase in the SELECT statement.