Examples - Teradata Database

SQL Data Manipulation Language

Product
Teradata Database
Release Number
15.10
Language
English (United States)
Last Update
2018-10-06
dita:id
B035-1146
lifecycle
previous
Product Category
Teradata® Database

Example : Retrieving a Comment

Suppose you have placed the following comment describing the name column in the employee table:

     COMMENT ON COLUMN employee.name 
       IS 'Employee name, last name followed by first initial';

The following request retrieves this comment:

     COMMENT ON COLUMN employee.name;

The request returns the comment string as created by the previous request:

     Employee name, last name followed by first initial

Note that because the object kind for this request is COLUMN, you must specify the keyword COLUMN when you code it.

Example : Placing a Comment

Suppose you have defined a hash index named ord_hidx defined on the orders table, which is contained in the accounting database.

Because the object kind for this request is TABLE, representing a hash index, you are not required to specify TABLE in the request.

You could type the following comment‑placing COMMENT request to define a comment on the hash index ord_hidx:

     COMMENT accounting.ord_hidx AS 'hash index on Orders';

Then if you were to perform the following comment‑retrieving COMMENT request, the text that follows would be returned to you:

     COMMENT accounting.ord_hidx;
     
     hash index on orders

For information about the comment‑placing form of this SQL statement, see “COMMENT (Comment-Placing Form)” in SQL Data Definition Language.