TITLE Phrase Rules - Teradata Vantage

Teradata® VantageCloud Lake

Deployment
VantageCloud
Edition
Lake
Product
Teradata Vantage
Published
January 2023
Language
English (United States)
Last Update
2024-04-03
dita:mapPath
phg1621910019905.ditamap
dita:ditavalPath
pny1626732985837.ditaval
dita:id
phg1621910019905

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

x Rule
Column reference with an explicit TITLE phrase Return title value.

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

Result:

Project
     Id
--------
OE2-0003
Column reference with no explicit TITLE Return column name.

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;

Result:

Salary
---------
35,000.00
Constant TITLE is a character representation of that constant. The character representation of the constant can 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;

Result:

Name     12
-------  --
Leidner  12
operator y, where operator is unary (+ or -) or aggregate 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;

Result:

Sum(Salary)
-----------
113,000.00
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;

Result:

Salary_Loan - 1000
------------------
          41000.00
attribute_function (y) TITLE is attribute_function, followed by (y).

Here is an example:

The following statement returns the indicated result.

SELECT FORMAT (Employee.EmpNo);

Result:

Format(EmpNo)
-------------
ZZZZ9
y (data_description), where data_description contains neither TITLE phrase nor NAMED phrase TITLE is (y).

Here is an example:

The following statement returns the indicated result.

SELECT YrsExp (BYTEINT)
FROM Employee
WHERE EmpNo = 10016;

Result:

YrsExp
------
    20
y (data_description), where data_description contains NAMED phrase but not TITLE 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;

Result:

YearsOfExperience
-----------------
               20
y (data_description), where data_description contains 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;

Result:

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.