The Concepts of ANSI Character Functions

Character functions are functions used to represent strings in SQL in formats alternate to how they are stored in the table. The first part of this hour discusses the concepts for character functions as covered by ANSI. The second part of this hour shows real-world examples using functions that are specific to various SQL implementations. ANSI functions discussed in this hour include concatenation, substring, TRANSLATE, REPLACE, UPPER, and LOWER.

Concatenation

Concatenation is the process of combining two separate strings into one string. For example, you may want to concatenate an individual's first and last names into a single string for the complete name.

JOHN concatenated with SMITH = JOHN SMITH

Substring

The concept of substring is the capability to extract part of a string, or a "sub" of the string. For example, the following values are substrings of JOHNSON:

J     JOHN    JO    ON    SON    …

TRANSLATE

The TRANSLATE function is used to translate a string, character by character, into another string. There are normally three arguments with the TRANSLATE function: the string to be converted, a list of the characters to convert, and a list of the substitution characters. Implementation examples are shown in the next part of this hour.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset