Using Functions to Modify the Appearance of Character Values

Many implementations of SQL provide functions to manipulate characters and strings of characters. This section covers the most common character functions. The examples in this section use the table CHARACTERS.

SQL> SELECT * FROM CHARACTERS;

LASTNAME        FIRSTNAME       M      CODE
--------------- --------------- - ---------
PURVIS          KELLY           A        32
TAYLOR          CHUCK           J        67
CHRISTINE       LAURA           C        65
ADAMS           FESTER          M        87
COSTALES        ARMANDO         A        77
KONG            MAJOR           G        52

6 rows selected.

The MySQL equivalent is

 mysql> select * from characters; +-----------+-----------+------+------+ | lastname | firstname | m | code | +-----------+-----------+------+------+ | PURVIS | KELLY | A | 32 | | TAYLOR | CHUCK | J | 67 | | CHRISTINE | LAURA ...

Get Sams Teach Yourself SQL in 21 Days, Fourth Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.