16.20 - Example - Advanced SQL Engine - Teradata Database

Teradata Vantage™ - SQL Functions, Expressions, and Predicates

Product
Advanced SQL Engine
Teradata Database
Release Number
16.20
Release Date
March 2019
Content Type
Programming Reference
Publication ID
B035-1145-162K
Language
English (United States)

If the Names table includes the columns first_name and last_name, which contain the following information:

   first_name (CHAR(12)) has a value of 'Mary       '
   last_name (CHAR(12)) has a value of  'Jones      '

then this statement:

   SELECT TRIM (BOTH FROM last_name) || ', ' || TRIM(BOTH FROM first_name) 
   FROM names ;

returns the following string (note that the seven trailing blanks at the end of string Jones, and the eight trailing blanks at the end of string Mary are not included in the result):

   'Jones, Mary'

If the TRIM function is removed, the statement:

   SELECT last_name || ', ' || first_name 
   FROM names;

returns trailing blanks in the string:

   'Jones       , Mary        '