The Concepts of ANSI Character Functions

Team-Fly    

 
Sams Teach Yourself SQL in 24 Hours, Third Edition
By Ronald R. Plew, Ryan K. Stephens
Table of Contents
Hour  11.  Restructuring the Appearance of Data


graphics/newterm_icon.gif

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

graphics/newterm_icon.gif

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.


Team-Fly    
Top
 


Sams Teach Yourself SQL in 24 Hours
Sams Teach Yourself SQL in 24 Hours (5th Edition) (Sams Teach Yourself -- Hours)
ISBN: 0672335417
EAN: 2147483647
Year: 2002
Pages: 275

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net